def get_dhandler(generated_with, peak_mag=19, **kwargs): if 'mosfit' in generated_with: number = '13' elif 'template' in generated_with: number = '03' else: number = None DataImportError( f'Input {generated_with} for generated_with not understood') dh_name = f'rappid_sim_model{number}_peakmag{peak_mag}' if peak_mag \ else f'rappid_sim_model{number}' logger.debug(f'dh name = {dh_name}') path = f'/afs/ifh.de/user/n/neckerja/scratch/ZTF_20190512/ZTF_MSIP_MODEL{number}.pkl' if os.path.isfile(DataHandler.dh_path(dh_name)): logger.info( f'DataHandler for {dh_name} already exists, loading it ...') return DataHandler.load_dh(dh_name) elif os.path.exists(path): logger.info(f'creating rappidDataHandler for {dh_name}') return rappidDH(generated_with=generated_with, peak_mag=peak_mag, **kwargs) else: raise DataImportError( f'ResultHandler for {dh_name} doesn\'t exist. ' f'Please sepcify path to the data!')
def __init__(self): logger.debug('initialising') self.make_pickle_file() DataHandler.__init__(self, pickle_filename, benchmarkDH.name, simulation=False) self.save_me()
def get_dhandler(**kwargs): dhpath = DataHandler.dh_path(ZTF20abdnpdoDataHandler.my_name) if kwargs.get('force_new', False): if os.path.isfile(dhpath): os.remove(dhpath) if os.path.isfile(dhpath): return DataHandler.load_dh(ZTF20abdnpdoDataHandler.my_name) else: return ZTF20abdnpdoDataHandler()
def get_dhandler(**kwargs): if os.path.isfile(DataHandler.dh_path(DummyDH.name)): logger.info(f'DataHandler for {DummyDH.name} already exists, loading it ...') return DataHandler.load_dh(DummyDH.name) elif os.path.exists(dummy_path): logger.info(f'creating DataHandler for {DummyDH.name}') return DummyDH() else: raise DataImportError(f'ResultHandler for {DummyDH.name} doesn\'t exist. ' f'Please specify path to the data!')
def get_dhandler(**kwargs): if os.path.isfile(DataHandler.dh_path(ExampleDH.name)): logger.info( f'DataHandler for {ExampleDH.name} already exists, loading it ...' ) return DataHandler.load_dh(ExampleDH.name) elif os.path.exists(pickle_filename): logger.info(f'creating rappidDataHandler for {ExampleDH.name}') return ExampleDH() else: raise DataImportError( f'ResultHandler for {ExampleDH.name} doesn\'t exist. ' f'Please sepcify path to the data!')
def __init__(self, generated_with, sed_directory, peak_mag=None): if 'mosfit' in generated_with: self.number = '13' elif 'template' in generated_with: self.number = '03' else: self.number = None DataImportError( f'Input {generated_with} for generated_with not understood') dh_name = f'rappid_sim_model{self.number}_peakmag{peak_mag}' if peak_mag \ else f'rappid_sim_model{self.number}' path = rappid_pkl_name(self.number, peak_mag) DataHandler.__init__(self, path, dh_name) self.sed_directory = self.dir + '/SEDs' if not os.path.isdir(self.sed_directory): logger.debug('making directory ' + self.sed_directory) os.mkdir(self.sed_directory) sed_directory += '/MODEL' + self.number itr = os.listdir(sed_directory) for file in itr if logger.getEffectiveLevel() > logging.INFO else tqdm( itr, desc='copying SED files'): if file.startswith('.'): continue copy2(f'{sed_directory}/{file}', self.sed_directory + '/') self.save_me()
def get_dhandler(**kwargs): if os.path.isfile(DataHandler.dh_path(benchmarkDH.name)): return DataHandler.load_dh(benchmarkDH.name) else: return benchmarkDH()
from estimate_explosion_time.shared import get_custom_logger, main_logger_name, all_methods import logging logger = get_custom_logger(main_logger_name) logger.setLevel(logging.DEBUG) from estimate_explosion_time.core.analyse_fits_from_simulation.plots import Plotter from estimate_explosion_time.core.data_prep.data import DataHandler from estimate_explosion_time.shared import get_custom_logger, main_logger_name import logging import argparse parser = argparse.ArgumentParser() parser.add_argument('ind', type=int, nargs='+') parser.add_argument('method', type=str) args = parser.parse_args() logger = get_custom_logger(main_logger_name) logger.setLevel(logging.DEBUG) dh = DataHandler.get_dhandler('dummy') plotter = Plotter(dh, args.method) for ind in args.ind: plotter.plot_lc(ind)
def __init__(self): self.make_pickle_file() DataHandler.__init__(self, name=ZTF20abdnpdoDataHandler.my_name, path=pickle_filename, simulation=False)
logger = get_custom_logger(main_logger_name) logger.setLevel(logging.DEBUG) logger.debug('logging level is DEBUG') from estimate_explosion_time.shared import simulation_dir from estimate_explosion_time.core.data_prep.data import DataHandler import pickle methods = all_methods[:-1] logger.debug(f'using methods{methods}') simulation_name = 'simsurvey_simulation' simsurvey_path = f'{simulation_dir}/{simulation_name}' simsurveyDH = DataHandler.get_dhandler(simulation_name, simsurvey_path) # simsurveyDH.select_and_adjust_selection_string( # req_prepeak=3, # req_postpeak=1, # req_max_timedif=50, # req_std=0.5, # check_band='all' # ) input('continue? ') for method in methods: logger.info(f'getting results for {simsurveyDH.name} analyzed by {method}') rhandler = simsurveyDH.rhandlers[method]
def __init__(self): input('I\'m about to create a new DataHandler for the Dummy simulations. Continue? ') DataHandler.__init__(self, path=dummy_path, name=DummyDH.name, simulation=True)
from estimate_explosion_time.shared import get_custom_logger, main_logger_name, all_methods import logging logger = get_custom_logger(main_logger_name) logger.setLevel(logging.DEBUG) from estimate_explosion_time.core.analyse_fits_from_simulation.plots import Plotter from estimate_explosion_time.core.data_prep.data import DataHandler from estimate_explosion_time.shared import get_custom_logger, main_logger_name import logging import argparse parser = argparse.ArgumentParser() parser.add_argument('ind', type=int, nargs='+') parser.add_argument('method', type=str, default='mosfit', nargs='+') args = parser.parse_args() logger = get_custom_logger(main_logger_name) logger.setLevel(logging.DEBUG) dh = DataHandler.get_dhandler('simsurvey_simulation') for method in args.method: plotter = Plotter(dh, method) for ind in args.ind: plotter.plot_lc(ind)
def __init__(self): DataHandler.__init__(self, path=pickle_filename, name=ExampleDH.name, simulation=False)
def __init__(self): input('I\'m about to create a new DataHandler for the Simsurvey simulations. Continue? ') DataHandler.__init__(self, path=simsurvey_path, name=SimsurveyDH.name)