Пример #1
0
    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 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!')
Пример #4
0
    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 get_dhandler(**kwargs):
     if os.path.isfile(DataHandler.dh_path(benchmarkDH.name)):
         return DataHandler.load_dh(benchmarkDH.name)
     else:
         return benchmarkDH()