Changeset 18291 for branches/trigger_burst_research/sketch.py
- Timestamp:
- 08/25/15 12:08:59 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/trigger_burst_research/sketch.py
r18289 r18291 1 1 # coding: utf-8 2 from collections import namedtuple 3 from sqlalchemy import create_engine 4 import pandas as pd 2 import calendar 5 3 import numpy as np 6 4 from astropy.io import fits 7 import fact 5 import pandas as pd 6 from sqlalchemy import create_engine 8 7 9 8 night_int = 20150721 9 10 11 def fjd(datetime_inst): 12 """ convert datetime instance to FJD 13 """ 14 return calendar.timegm(datetime_inst.utctimetuple()) / (24.*3600.) 10 15 11 16 def create_DB_connection(): … … 52 57 53 58 54 def get_trigger_rates(night_int, base_path='other_aux_data/'): 59 def get_trigger_rates(night_int, base_path='/fact/aux/'): 60 night_string = str(night_int) 55 61 fits_file = fits.open( 56 base_path+'{0}.FTM_CONTROL_TRIGGER_RATES.fits'.format(night_int) 62 base_path+'{y}/{m}/{d}/{n}.FTM_CONTROL_TRIGGER_RATES.fits'.format( 63 ni=night_string, 64 y=night_string[0:4], 65 m=night_string[4:6], 66 d=night_string[6:8], 67 ) 57 68 ) 58 69 trigger_rates = fits_file[1].data … … 71 82 this_run = data_runs.ix[dataframe_index] 72 83 mask = ( 73 (trigger_rates['Time'] > f act.fjd(this_run['fRunStart'])) *74 (trigger_rates['Time'] < f act.fjd(this_run['fRunStop']))84 (trigger_rates['Time'] > fjd(this_run['fRunStart'])) * 85 (trigger_rates['Time'] < fjd(this_run['fRunStop'])) 75 86 ) 76 87 this_board_rates = trigger_rates['BoardRate'][mask]
Note:
See TracChangeset
for help on using the changeset viewer.