def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: try: val = nudie.parse_config(config, which='tg')['tg'] except ValueError as e: nudie.log.error('could not validate file. Please check ' +\ 'configuration options.') return if val['stark']: s = 'the stark flag is set in the configuration. You should be ' +\ 'running the stark-tg.py script.' nudie.log.error(s) return run(tg_name=val['jobname'], tg_batch=val['batch'], when=val['when'], wavelengths=val['wavelengths'], plot=val['plot'], pad_to=val['detection axis zero pad to'], prd_est=val['probe ref delay'], lo_width=val['lo width'], dc_width=val['dc width'], gaussian_power=val['gaussian power'], analysis_path=val['analysis path'], datapath=val['data path']) except Exception as e: nudie.log.exception(e)
def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: try: val = nudie.parse_config(config, which='phasing')['phasing'] except ValueError as e: nudie.log.error('could not validate file. Please check ' +\ 'configuration options.') return if val['copy']: s = '`copy` flag is set. You should be using the apply-phase.py ' +\ 'script instead' nudie.log.error(s) return run(val['path'], val['reference name'], val['reference batch'], val['experiment name'], val['experiment batch'], plot=val['plot'], force=val['force'], limits=val['pixel range to fit'], phaselock_wl=val['phaselock wl'], central_wl=val['central wl'], nsteps=val['nsteps'], niter_success=val['nstep success'], phasing_guess=val['phasing guess'], phase_time=val['phasing t2'], excitation_axis_zero_pad_to=val['excitation axis zero pad to'], smooth_t1=val['smooth t1']) except Exception as e: nudie.log.exception(e)
def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: try: val = nudie.parse_config(config, which='linear')['linear'] except ValueError as e: nudie.log.error('could not validate file. Please check ' +\ 'configuration options.') return if val['stark'] != True: s = 'the stark flag is not set in the configuration. ' +\ 'Are you sure you are using the right configuration file?' nudie.log.error(s) return run(stark_name=val['jobname'], stark_batch=val['batch'], when=val['when'], wavelengths=val['wavelengths'], plot=val['plot'], analysis_path=val['analysis path'], datapath=val['data path']) except Exception as e: nudie.log.exception(e)
def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: val = nudie.parse_config(config, which='2d')['2d'] if val['stark'] != True: s = 'this is not a stark dataset according to the config file. ' +\ 'Are you sure you shouldn\'t be running the 2d script?' nudie.log.error(s) return run(dd_name=val['jobname'], dd_batch=val['batch'], when=val['when'], wavelengths=val['wavelengths'], plot=val['plot'], central_wl=val['central wl'], phaselock_wl=val['phaselock wl'], pad_to=val['detection axis zero pad to'], waveforms_per_table=val['waveforms per table'], prd_est=val['probe ref delay'], lo_width=val['lo width'], dc_width=val['dc width'], gaussian_power=val['gaussian power'], analysis_path=val['analysis path'], min_field=val['field on threshold'], detrend_t1=val['detrend t1'], datapath=val['data path']) except Exception as e: nudie.log.exception(e)
def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: try: val = nudie.parse_config(config, which='phasing')['phasing'] except ValueError as e: nudie.log.error('could not validate file. Please check ' +\ 'configuration options.') return if val['copy'] == False: s = '`copy` flag is not set. You should be using the phasing.py ' +\ 'script instead' nudie.log.error(s) return run(val['path'], val['reference name'], val['reference batch'], val['experiment name'], val['experiment batch'], plot=val['plot'], force=val['force'], phase_correct=val['phase correct'], smooth_t1=val['smooth t1']) except Exception as e: nudie.log.exception(e)
def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: try: val = nudie.parse_config(config, which='pump probe')['pump probe'] except ValueError as e: nudie.log.error('could not validate file. Please check ' +\ 'configuration options.') return run(pp_name=val['jobname'], pp_batch=val['batch'], when=val['when'], plot=val['plot'], wavelengths=val['wavelengths'], exclude=val['exclude'], analysis_path=val['analysis path'], datapath=val['data path']) except Exception as e: nudie.log.exception(e)
def main(config, verbosity=nudie.logging.INFO): nudie.show_errors(verbosity) try: try: val = nudie.parse_config(config, which='2d')['2d'] except ValueError as e: nudie.log.error('could not validate file. Please check ' +\ 'configuration options.') return if val['stark']: s = 'the stark flag is set in the configuration. You should be ' +\ 'running the stark-2d.py script.' nudie.log.error(s) return run(dd_name=val['jobname'], dd_batch=val['batch'], when=val['when'], wavelengths=val['wavelengths'], plot=val['plot'], pump_chop=val['pump chop'], central_wl=val['central wl'], phaselock_wl=val['phaselock wl'], pad_to=val['detection axis zero pad to'], waveforms_per_table=val['waveforms per table'], prd_est=val['probe ref delay'], lo_width=val['lo width'], dc_width=val['dc width'], gaussian_power=val['gaussian power'], analysis_path=val['analysis path'], detrend_t1=val['detrend t1'], datapath=val['data path']) except Exception as e: nudie.log.exception(e)
run(tg_name=val['jobname'], tg_batch=val['batch'], when=val['when'], wavelengths=val['wavelengths'], plot=val['plot'], pad_to=val['detection axis zero pad to'], prd_est=val['probe ref delay'], lo_width=val['lo width'], dc_width=val['dc width'], gaussian_power=val['gaussian power'], analysis_path=val['analysis path'], datapath=val['data path']) except Exception as e: nudie.log.exception(e) if __name__ == '__main__': from sys import argv # turn on printing of errors level = nudie.logging.INFO nudie.show_errors(level) if len(argv) < 2: s = 'need a configuration file name as a parameter' nudie.log.error(s) sys.exit(-1) main(argv[1], level)
import nudie from nudie.dataset import * from dask.delayed import delayed nudie.show_errors(nudie.logging.INFO) ''' d = Dataset('test.h5', 'w') print('readonly? {!s}'.format(d.readonly)) try: d = Dataset('test2.h5', 'r') print('readonly? {!s}'.format(d.readonly)) except Exception: pass PP('pp-phasing-batch00.h5') DD('2d-phasing-batch00.h5') DDESS('2dess-batch00.h5') TG('tg-batch00.h5') TGStark('tg-stark-batch00.h5') ''' c = Config({ 'FastDazzlerSetupLoader': { 'batch_path': 'test-data/clh-linear-stark-s3-batch00', 'batch_name': 'clh-linear-stark-s3', 'data_type': LinearStark, 'allow_parallel': True, } }) loader = FastDazzlerSetupLoader(config=c) a = loader.load()
from __future__ import division import pytest import numpy as np import itertools as it import nudie nudie.show_errors(nudie.logging.DEBUG) def test_BoolStr(): for s in ['True', '1', 'tRue', 'YES', 'ON', 'yEs']: assert nudie.schema.BoolStr(s) == True for s in ['false', '0', 'FaLSE', 'OFF', 'ofF', 'NO', 'no']: assert nudie.schema.BoolStr(s) == False def test_parse_config_basic(tmpdir): p = tmpdir.join('test_cfg.ini') p.write(\ ''' [pump probe] jobname = asldkfja batch = 10 when = 09123 wavelengths = alkdfja analysis path = alksdjfalskdjf ''')