Ignore:
Timestamp:
08/25/15 12:08:59 (9 years ago)
Author:
dneise
Message:
some mods, so the stuff can maybe also be executed by somebody else :-|
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/trigger_burst_research/sketch.py

    r18289 r18291  
    11# coding: utf-8
    2 from collections import namedtuple
    3 from sqlalchemy import create_engine
    4 import pandas as pd
     2import calendar
    53import numpy as np
    64from astropy.io import fits
    7 import fact
     5import pandas as pd
     6from sqlalchemy import create_engine
    87
    98night_int = 20150721
     9
     10
     11def fjd(datetime_inst):
     12    """ convert datetime instance to FJD
     13    """
     14    return calendar.timegm(datetime_inst.utctimetuple()) / (24.*3600.)
    1015
    1116def create_DB_connection():
     
    5257
    5358
    54 def get_trigger_rates(night_int, base_path='other_aux_data/'):
     59def get_trigger_rates(night_int, base_path='/fact/aux/'):
     60    night_string = str(night_int)
    5561    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            )
    5768        )
    5869    trigger_rates = fits_file[1].data
     
    7182        this_run = data_runs.ix[dataframe_index]
    7283        mask = (
    73             (trigger_rates['Time'] > fact.fjd(this_run['fRunStart'])) *
    74             (trigger_rates['Time'] < fact.fjd(this_run['fRunStop']))
     84            (trigger_rates['Time'] > fjd(this_run['fRunStart'])) *
     85            (trigger_rates['Time'] < fjd(this_run['fRunStop']))
    7586            )
    7687        this_board_rates = trigger_rates['BoardRate'][mask]
Note: See TracChangeset for help on using the changeset viewer.