def test_parse_config_apply_phase(tmpdir): p = tmpdir.join('test_cfg.ini') p.write(\ ''' [phasing] path = 15-05-12 reference name = d1d2-2d reference batch = 0 2d name = d1d2-2d ''') with pytest.raises(ValueError): nudie.parse_config(p.strpath, which='phasing')
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='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: 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: 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 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 ''') with pytest.raises(ValueError): nudie.parse_config(p.strpath, which='asldkajslkdj') with pytest.raises(ValueError): nudie.parse_config(p.strpath, which='2d') with pytest.raises(ValueError): nudie.parse_config(p.strpath, which='phasing') nudie.parse_config(p.strpath, which='pump probe')
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)