Changeset 13807 for fact/tools/PyDimCtrl
- Timestamp:
- 05/21/12 19:40:51 (12 years ago)
- Location:
- fact/tools/PyDimCtrl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/PyDimCtrl/fpydim.py
r13805 r13807 28 28 self.reg_state_cb() 29 29 self.reg_msg_cb() 30 self.user_func = None 30 31 31 32 def _cmd(self, cmdstr, *args): … … 96 97 print "list_of_states too long, truncating..." 97 98 self.list_of_states = self.list_of_states[1000:] 99 100 if self.user_func: 101 self.user_func( self.stn ) 102 98 103 if self.print_state: 99 104 print state -
fact/tools/PyDimCtrl/service.py
r13806 r13807 99 99 time.sleep(CalmDownTime) 100 100 return True 101 102 def PrepareBias( verbose = True):103 msg = MSG()104 msg.output = verbose105 bias = bias_control106 107 if feedback() != 12:108 msg.warn("feedback is not in Current Control")109 return False110 111 bias.set_global_dac(1)112 if not bias.wait(9, 10):113 msg.warn("bias not in Voltage ON after 10sec")114 return False115 if not bias.wait(5, 10):116 msg.warn("bias not Ramping after 10sec")117 return False118 if not bias.wait(9, 30):119 msg.warn("bias not fully ramped up after 30sec")120 return False121 122 msg("waiting 45sec...")123 time.sleep(45)124 return True125 126 101 def TakePedestalOnRun( verbose = True ): 127 102 msg = MSG() … … 188 163 return True 189 164 190 def TakeDrsCalibration( verbose = True):191 msg = MSG()192 msg.output = verbose193 bias = bias_control194 fad = fad_control195 196 bias.set_zero_voltage()197 if not bias.wait(7, 10):198 msg.warn("bias has not switched of after 10sec")199 return False200 fad.start_drs_calibration()201 Take( -1, 1000, 'drs-pedestal')202 Take( -1, 1000, 'drs-gain')203 Take( -1, 1000, 'drs-pedestal')204 fad.set_file_format(2)205 Take( -1, 1000, 'drs-pedestal')206 Take( -1, 1000, 'drs-time')207 Take( -1, 1000, 'drs-time-upshifted')208 fad.reset_secondary_drs_baseline()209 Take(-1, 1000, 'pedestal')210 fad.set_file_format(2)211 Take(-1, 1000, 'pedestal')212 165 213 166 def BlinkenLights(verbose = True): … … 221 174 time.sleep(1) 222 175 223 def TakeAmplCalib( roi=1024, verbose=True): 224 msg = MSG(verbose) 225 bias = bias_control 226 fad = fad_control 227 if (roi!=1024) and (roi!=300): 228 raise ValueError('roi must be 300 or 1024') 229 # I do not understand, why the out put needs to be ENABLED?? 230 feedback.enable_output(0) 231 bias.set_zero_voltage() 232 bias.wait(7) # VoltageOff 233 fad.start_drs_calibration 234 235 Take(-1, 1000, 'drs-pedestal') 236 Take(-1, 1000, 'drs-gain') 237 if roi == 300: 238 Take(-1, 1000, 'pedestal') 239 if roi == 1024: 240 Take(-1, 1000, 'drs-pedestal') 241 242 fad.set_file_format(2) 243 if roi == 300: 244 Take(-1, 1000, 'pedestal') 245 if roi == 1024: 246 Take(-1, 1000, 'drs-pedestal') 247 248 def TakeTimeCalib( verbose=True ): 249 msg = MSG( verbose ) 250 feedback.enable_output(0) 251 if bias() != 7: 252 bias.set_zero_voltage() 253 if not bias.wait(7, 10): 254 msg.warn("bias not ramped down after 10sec") 255 return False 256 fad.set_file_format(2) 257 Take(-1, 1000, 'drs-time') 258 Take(-1, 1000, 'drs-time-upshifted') 259 260 261 262 263 def Connect( verbose=True ): 264 176 177 178 179 #============================================================================== 180 def Connect(): 265 181 prepare_ftm_control() 266 182 prepare_fsc_control() … … 269 185 prepare_feedback() 270 186 prepare_data_logger() 271 272 187 273 188 def prepare_fsc_control( verbose = True, timeout = 10, delay = 0.2): … … 516 431 517 432 433 434 #============================================================================== 435 def TakeDrsAmplitudeCalibration( roi = None, verbose = True): 436 """ Takes DRS Amplitude Calibration 437 *roy* integer: 300, 1024 or 438 *roy* string : 'both' 439 in case of both, the roi=300 calibration is done last. 440 441 after each complete AmpliteCalibration a 4th pedestal run of the same 442 roi is taken, for crosschecking. 443 """ 444 msg = MSG( verbose ) 445 bias = bias_control 446 fad = fad_control 447 if not roi in [300,1024,'both']: 448 raise ValueError("roi must be 300,1024 or the string 'both'") 449 450 451 bias.set_zero_voltage() 452 if not bias.wait(7, 10): 453 msg.warn("bias has not switched of after 10sec") 454 return False 455 456 fad.start_drs_calibration() 457 Take( -1, 1000, 'drs-pedestal') 458 Take( -1, 1000, 'drs-gain') 459 if roi == 300: 460 Take( -1, 1000, 'pedestal') 461 fad.set_file_format(2) 462 Take( -1, 1000, 'pedestal') 463 elif roi == 1024: 464 Take( -1, 1000, 'drs-pedestal') 465 fad.set_file_format(2) 466 Take( -1, 1000, 'drs-pedestal') 467 elif roi == 'both': 468 Take( -1, 1000, 'drs-pedestal') 469 fad.set_file_format(2) 470 Take( -1, 1000, 'drs-pedestal') 471 fad.reset_secondary_drs_baseline() 472 Take( -1, 1000, 'pedestal') 473 fad.set_file_format(2) 474 Take( -1, 1000, 'pedestal') 475 476 477 def TakeDrsTimeCalibration( mode = None, verbose = True): 478 """ Takes DRS Time Calibration 479 *mode* can be 'upshifted', 'old' or 'both' 480 """ 481 msg = MSG( verbose ) 482 bias = bias_control 483 fad = fad_control 484 if not mode in ['upshifted', 'old', 'both']: 485 raise ValueError("mode must be: 'upshifted','old' or 'both'") 486 487 bias.set_zero_voltage() 488 if not bias.wait(7, 10): 489 msg.warn("bias has not switched of after 10sec") 490 return False 491 492 fad.set_file_format(2) 493 if mode == 'old': 494 Take(-1, 1000, 'drs-time') 495 if mode == 'upshifted': 496 Take(-1, 1000, 'drs-time-upshifted') 497 if mode == 'both': 498 Take(-1, 1000, 'drs-time') 499 Take(-1, 1000, 'drs-time-upshifted') 500 501 502 def VoltageOn( mode = None, Watchdog = None, verbose = True): 503 msg = MSG( verbose ) 504 bias = bias_control 505 fb = feedback 506 507 if not mode in ['temperature', 'current', 'feedback']: 508 raise ValueError("mode must be 'temperature', 'current' or 'feedback'") 509 510 feedback.start(..... blaaaaa .....) 511 hier muss noch ne menge passieren 512 513 bias.set_global_dac(1) 514 if not bias.wait(9, 10): 515 msg.warn("bias not in Voltage ON after 10sec") 516 return False 517 if not bias.wait(5, 10): 518 msg.warn("bias not Ramping after 10sec") 519 return False 520 if not bias.wait(9, 30): 521 msg.warn("bias not fully ramped up after 30sec") 522 return False 523 524 msg("waiting 45sec...") 525 time.sleep(45) 526 return True 527 528 # standard watchdogs: 529 def std_bias_watchdog( state, verbose=True ): 530 msg = MSG(verbose) 531 if state == 1: #Disconnected 532 msg.warn("BIAS just DISCONNECTED .. trying to reconnect") 533 msg.warn("current runnumber:"+fad_control.runnumber() ) 534 bias.reconnect() 535 time.sleep(1) 536 bias.set_zero_voltage() 537 # TODO: This should work, but it is stupid. 538 bias.reset_over_current_status() 539 bias.reset_over_current_status() 540 bias.set_zero_voltage() 541 bias.reset_over_current_status() 542 bias.set_global_dac(1) 518 543 519 544 # create introduction:
Note:
See TracChangeset
for help on using the changeset viewer.