The following script shows how an MCA is operated. The timer is gating the ADC which feeds the MCA.
#!/usr/bin/env python from PyTango import * import sys import time try : mca1 = DeviceProxy( "p09/mca/exp.01") t1 = DeviceProxy( "p09/timer/exp.01") # # BankId can be 0 or 1 # mca1.BankId = 0 t1.Stop() mca1.Clear() mca1.Start() # # start the timer # t1.SampleTime = 0.5 t1.Start() while( t1.Check()): print( " Timer: ", t1.Read()) time.sleep(0.1) mca1.Stop() mca1.Read() len = mca1.DataLength print( " Spectrum length ", len) attr = mca1.Data for i in range(len): if attr[i] > 0: print( i, ": ", attr[i]) except : print( "Failed with exception !") print( sys.exc_info()[0] )