Changeset 14459 for fact/tools


Ignore:
Timestamp:
10/03/12 21:45:47 (12 years ago)
Author:
neise
Message:
deleted quite some overhead
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/PyDimCtrl/ScriptsForPyDimCtrl.py

    r14458 r14459  
    265265
    266266
    267 def TakeDataRun():
    268   """ Take a 5min Data Run
    269   """
    270   # check if all subsystems are in the correct state 
    271   IsReadyForDataTaking()
    272 
    273   print ' taking Data:FullTriggerArea 5min Run ...'
    274   mcp.start( 300, -1, 'data\0')
    275 
    276   print '...waiting for FAD to be in state 8: Writing Data'
    277   fad_control.wait(8) # Writing Data
    278   print '...waiting for FAD to be in state 4: Connected'
    279   fad_control.wait(4) # Connected
    280   print '... done'
    281267
    282268def TakeExtLpRun():
     
    287273
    288274  print 'taking External Light Pulser with BIAS on 1000 ...'
    289   mcp.start(-1, 1000, 'light-pulser-ext\0')
    290 
    291   print '...waiting for FAD to be in state 8: Writing Data'
    292   fad_control.wait(8) # Writing Data
    293   print '...waiting for FAD to be in state 4: Connected'
    294   fad_control.wait(4) # Connected
    295   print '... done'
     275  Take(-1, 1000, 'light-pulser-ext')
    296276 
    297277def TakePedestalOnRun():
     
    302282
    303283  print 'taking External Light Pulser with BIAS on 1000 ...'
    304   mcp.start(-1, 1000, 'pedestal\0')
    305 
    306   print '...waiting for FAD to be in state 8: Writing Data'
    307   fad_control.wait(8) # Writing Data
    308   print '...waiting for FAD to be in state 4: Connected'
    309   fad_control.wait(4) # Connected
    310   print '... done'
    311 
    312 
    313 def Take( time, num_events, runtype):
     284  Take(-1, 1000, 'pedestal')
     285
     286
     287def Take( time, num_events, runtype, verbose=False):
    314288  """ more general version of e.g. TakePedestalOnRun
    315289    Note: One has to check, if Ready for *Take* by oneself
     
    319293  #IsReadyForDataTaking()
    320294
    321   print ' taking', runtype,'. ', num_events, 'events in', time, 'seconds'
     295  if verbose:
     296    print ' taking', runtype,'. ', num_events, 'events in', time, 'seconds'
    322297  mcp.start(time, num_events, runtype)
    323298
    324   print '...waiting for FAD to be in state 8: Writing Data'
     299  if verbose:
     300    print '...waiting for FAD to be in state 8: Writing Data'
    325301  fad_control.wait(8) # Writing Data
    326   print '...waiting for FAD to be in state 4: Connected'
    327   fad_control.wait(4) # Connected
    328   print '... done'
     302  if verbose:
     303    print '...waiting for FAD to be in state 4: Connected'
     304  fad_control.wait_nice(4) # Connected
     305  if verbose:
     306    print '... done'
    329307
    330308
     
    344322    print 'taking data run', run+1, 'out of 4'
    345323    IsTracking()
     324
    346325    TakeDataRun()
     326
     327def TakeDataRun():
     328  """ Take a 5min Data Run
     329  """
     330  # check if all subsystems are in the correct state 
     331  IsReadyForDataTaking()
     332  Take( 300, -1, 'data')
     333
    347334
    348335def TakeDrsCalibration():
     
    414401  print 'DRS-Calibration before Data taking'
    415402  print '----------------------------------------------------'
    416 
    417 def DataTaking1():
    418   """ Script for taking data when you are tracking wobble position 1
    419     take a DRS CaLibration and physics Data afterwards
    420   """
    421   # Move Telescope to Wobble Position 1
    422   print '--------------------------------------'
    423   print 'data taking for Wobble 1'
    424   print 'starting up...'
    425   print '--------------------------------------'
    426   print 'OPERATOR:'
    427   print 'make sure the telescope is tracking'
    428   print 'wobble position 1 of the source'
    429   print '--------------------------------------'
    430 
    431   # Take a DRS-Calibration before beginning to take physics Data
    432   #TakeDrsCalibration()
    433 
    434   # check feedback state before switching BIAS ON and ramping up to nominal Voltage
    435   PrepareBiasForDataTaking()
    436 
    437   # taking a Data Set (1x Pedestal 1000 Bias On, 1x LPext 1000, 4x5min DataRun)
    438   TakeData()
    439 
    440   print '--------------------------------------'
    441   print 'data taking for Wobble 1 finished'
    442   print '--------------------------------------'
    443 
    444 def DataTaking2():
    445   """ Script for taking data when you are tracking wobble position 2
    446   """
    447   # Move Telescope to Wobble Position 2
    448   print '--------------------------------------'
    449   print 'data taking for Wobble 2'
    450   print 'starting up...'
    451   print '--------------------------------------'
    452   print '--------------------------------------'
    453   print 'OPERATOR:'
    454   print '+ make sure the telescope is tracking'
    455   print '  wobble position 2 of the source'
    456   print '+ Measure Sky Brightness'
    457   print '--------------------------------------'
    458 
    459 
    460   # taking a Data Set (1x Pedestal 1000 Bias On, 1x LPext 1000, 4x5min DataRun)
    461   TakeData()
    462 
    463   print '--------------------------------------'
    464   print 'data taking for Wobble 2 finished'
    465   print '--------------------------------------'
    466 
    467 def TrackCrabWobble1():
    468   """ changing tracking to "Crab" Wobble 1
    469   """
    470   print 'moving telescope to wobble position 1'
    471   print '...waiting for DRIVE_CONTROL'
    472   print '   to be in state 6: Armed'
    473 
    474   drive_control.wait(6) #Armed
    475   print 'DRIVE: ARMED'
    476   time.sleep(5.)
    477 
    478   drive_control.track_source( 0.6, 50, 'Crab\0')
    479   # we store this command in global vars, so it is increadibly easy, to
    480   # do this call again, when needed
    481   last_drive_method = drive_control.track_source
    482   last_drive_kwargs = { 'wobble_offset' : 0.6,
    483                           'wobble_angle' : 50,
    484                           'source_name' : 'Crab\0' }
    485   # so in case, this call needs to be repeated, just do
    486   # last_drive_method(**last_drive_kwargs)
    487  
    488   print '...sent tracking command for Crab Wobble 1'
    489   print 'COMMAND: DRIVE_CONTROL/TRACK_SOURCE 0.6 50 Crab'
    490 
    491 def TrackCrabWobble2():
    492   """ changing tracking to "Crab" Wobble 2
    493   """
    494   print 'moving telescope to wobble position 2'
    495   print '...waiting for DRIVE_CONTROL'
    496   print '   to be in state 6: Armed'
    497 
    498   drive_control.wait(6) #Armed
    499   print 'DRIVE: ARMED'
    500   time.sleep(5.)
    501 
    502   # we store this command in global vars, so it is increadibly easy, to
    503   # do this call again, when needed
    504   last_drive_method = drive_control.track_source
    505   last_drive_kwargs = { 'wobble_offset' : 0.6,
    506                           'wobble_angle' : -130,
    507                           'source_name' : 'Crab\0' }
    508   # so in case, this call needs to be repeated, just do
    509   last_drive_method(**last_drive_kwargs)
    510  
    511   print '...sent tracking command for Crab Wobble 2'
    512   print 'COMMAND: DRIVE_CONTROL/TRACK_SOURCE 0.6 -130 Crab'
    513 
    514403
    515404
     
    611500  fad_control.start_drs_calibration()
    612501  time.sleep(0.5)
    613   mcp.start(-1, 1000, "drs-pedestal\0")
    614 
    615   print "...waiting for FAD to be in state 8: Writing Data"
    616   fad_control.wait(8)
    617   print "...waiting for FAD to be in state 4: Connected"
    618   fad_control.wait_nice(4)
    619   print "... done"
     502  Take( -1, 1000, 'drs-pedestal')
    620503
    621504  print "taking DRS:Gain 1000 ..."
    622   mcp.start(-1, 1000, 'drs-gain\0')
    623   print "...waiting for FAD to be in state 8: Writing Data"
    624   fad_control.wait(8)
    625   print "...waiting for FAD to be in state 4: Connected"
    626   fad_control.wait_nice(4)
    627   print "... done"
     505  Take( -1, 1000, 'drs-gain')
    628506
    629507  time.sleep(2)
     
    635513
    636514  print "taking Pedestal 1000 ..."
    637   mcp.start( -1, 1000, 'pedestal\0')
    638   print "...waiting for FAD to be in state 8: Writing Data"
    639   fad_control.wait(8)
    640   print "...waiting for FAD to be in state 4: Connected"
    641   fad_control.wait(4)
    642   print "... done"
     515  Take( -1, 1000, 'pedestal')
    643516
    644517  # okay this is the DRS calibration for the next few runs.
     
    648521  print "taking crosscheck Pedestal 1000 ..."
    649522  fad_control.set_file_format(2)
    650 
    651   mcp.start(-1, 1000, 'pedestal\0')
    652   print "...waiting for FAD to be in state 8: Writing Data"
    653   fad_control.wait(8)
    654   print "...waiting for FAD to be in state 4: Connected"
    655   fad_control.wait(4)
    656   print "... done"
     523  Take(-1, 1000, 'pedestal')
    657524
    658525  # now we want to take a run, with dark counts events
     
    693560  # then the DRS calibration above, and the pedestal run in between have to be changed as well.
    694561  print "taking Pedestal with BIAS on 3000 ..."
    695   mcp.start(-1, 3000, 'pedestal\0')
    696   print "...waiting for FAD to be in state 8: Writing Data"
    697   fad_control.wait(8)
    698   print "...waiting for FAD to be in state 4: Connected"
    699   fad_control.wait(4)
    700   print "... done"
     562  Take(-1, 3000, 'pedestal')
    701563
    702564  # at the end the bias voltage should be ramped down, since in a few seconds a shifter wit ha flashlight
     
    920782  return GUII.mean(), GUII.std(), GUII.max(), GUII.min()
    921783
    922 def TakeCrab():
    923   """ Data taking and tracking script for Crab
    924   """
    925   print '======================================'
    926   print 'Data taking and tracking script for'
    927   print 'Crab'
    928   print '======================================'
    929   print 'starting up...'
    930 
    931   # changing tracking to Crab Wobble 1
    932   TrackCrabWobble1()
    933 
    934   # Wait for drivectrl to reply that its tracking the given source
    935   WaitForTracking()
    936 
    937   DataTaking1()
    938 
    939   # changing tracking to Crab Wobble 2
    940   TrackCrabWobble2()
    941 
    942   # Wait for drivectrl to reply that its tracking the given source
    943   WaitForTracking()
    944 
    945   # data taking to Crab Wobble 2
    946   DataTaking2()
    947 
    948   # Stop tracking
    949   StopTracking()
    950 
    951   print '======================================'
    952   print 'Data taking and tracking script for'
    953   print 'Crab FINISHED'
    954   print '======================================'
    955784 
    956785
     
    1011840
    1012841
    1013 def TrackCrabWobble1_new():
    1014   """ changing tracking to "Crab" Wobble 1
    1015   """
    1016   TrackSourceWobbleX( 'Crab', 1)
    1017 
    1018 def TrackCrabWobble2_new():
    1019   """ changing tracking to "Crab" Wobble 1
    1020   """
    1021   TrackSourceWobbleX( 'Crab', 2)
    1022 
    1023 
    1024842def TakeSource( name ):
    1025843  if name not in sourcedict:
     
    1030848  TrackSourceWobbleX( name, 1) # Track Wobble pos 1 of source
    1031849  WaitForTracking()
    1032   DataTaking1()
     850  # Take a DRS-Calibration before beginning to take physics Data
     851  TakeDrsCalibration()
     852  # check feedback state before switching BIAS ON and ramping up to nominal Voltage
     853  PrepareBiasForDataTaking()
     854  # taking a Data Set (1x Pedestal 1000 Bias On, 1x LPext 1000, 4x5min DataRun)
     855  TakeData()
     856  StopTracking()
    1033857
    1034858  TrackSourceWobbleX( name, 2) # Track Wobble pos 2 of source
    1035859  WaitForTracking()
    1036   DataTaking2()
    1037  
     860  # taking a Data Set (1x Pedestal 1000 Bias On, 1x LPext 1000, 4x5min DataRun)
     861  TakeData()
     862
    1038863  StopTracking()
    1039864
Note: See TracChangeset for help on using the changeset viewer.