def pocs_with_dome(config_with_simulated_dome): os.environ['POCSTIME'] = '2016-08-13 13:00:00' simulator = hardware.get_all_names(without=['dome']) observatory = Observatory(config=config_with_simulated_dome, simulator=simulator, ignore_local_config=True) pocs = POCS(observatory, run_once=True, config=config_with_simulated_dome, ignore_local_config=True, db='panoptes_testing') pocs.observatory.scheduler.fields_list = [ {'name': 'Wasp 33', 'position': '02h26m51.0582s +37d33m01.733s', 'priority': '100', 'exp_time': 2, 'min_nexp': 2, 'exp_set_size': 2, }, ] yield pocs pocs.power_down()
def pocs(target): try: del os.environ['POCSTIME'] except KeyError: pass config = load_config(ignore_local=False) pocs = POCS(simulator=['weather', 'night', 'camera'], run_once=True, config=config, db='panoptes_testing', messaging=True) pocs.observatory.scheduler.fields_list = [ { 'name': 'Testing Target', 'position': target.to_string(style='hmsdms'), 'priority': '100', 'exp_time': 2, 'min_nexp': 2, 'exp_set_size': 2, }, ] yield pocs pocs.power_down()
def test_state_machine_absolute(temp_file): state_table = POCS.load_state_table() assert isinstance(state_table, dict) with open(temp_file, 'w') as f: f.write(yaml.dump(state_table)) file_path = os.path.abspath(temp_file) assert POCS.load_state_table(state_table_name=file_path)
def start_pocs(): observatory.config['simulator'] = ['camera', 'mount', 'night'] pocs = POCS(observatory, messaging=True, safe_delay=15) pocs.db.current.remove({}) pocs.initialize() pocs.logger.info('Starting observatory run') assert pocs.is_weather_safe() is False pocs.send_message('RUNNING') pocs.run(run_once=True, exit_when_done=True) assert pocs.is_weather_safe() is True
def pocs(config, observatory): os.environ['POCSTIME'] = '2016-08-13 13:00:00' pocs = POCS(observatory, run_once=True, config=config, ignore_local_config=True, db='panoptes_testing') pocs.observatory.scheduler.fields_list = [ {'name': 'Wasp 33', 'position': '02h26m51.0582s +37d33m01.733s', 'priority': '100', 'exp_time': 2, 'min_nexp': 2, 'exp_set_size': 2, }, ] yield pocs pocs.power_down()
def start_pocs(): pocs = POCS(observatory, messaging=True) pocs.logger.info('Before initialize') pocs.initialize() pocs.logger.info('POCS initialized, back in test') pocs.observatory.scheduler.fields_list = [{'name': 'KIC 8462852', 'position': '20h06m15.4536s +44d27m24.75s', 'priority': '100', 'exp_time': 2, 'min_nexp': 1, 'exp_set_size': 1, }] pocs.run(exit_when_done=True, run_once=True) pocs.logger.info('run finished, powering down') pocs.power_down()
def pocs(target): try: del os.environ['POCSTIME'] except KeyError: pass config = load_config(ignore_local=False) pocs = POCS(simulator=['weather', 'night', 'camera'], run_once=True, config=config, db='panoptes_testing', messaging=True) pocs.observatory.scheduler.fields_list = [ {'name': 'Testing Target', 'position': target.to_string(style='hmsdms'), 'priority': '100', 'exp_time': 2, 'min_nexp': 2, 'exp_set_size': 2, }, ] yield pocs pocs.power_down()
def start_pocs(): pocs = POCS(observatory, messaging=True) pocs.initialize() pocs.observatory.scheduler.fields_list = [{'name': 'KIC 8462852', 'position': '20h06m15.4536s +44d27m24.75s', 'priority': '100', 'exp_time': 2, 'min_nexp': 1, 'exp_set_size': 1, }] pocs.logger.info('Starting observatory run') pocs.run()
def test_bad_state_machine_file(): with pytest.raises(error.InvalidConfig): POCS.load_state_table(state_table_name='foo')
#!/usr/bin/env python3 from pocs import hardware from pocs import POCS pocs = POCS(simulator=hardware.get_all_names(without=['mount', 'night'])) pocs.observatory.mount.initialize() pocs.observatory.mount.home_and_park() pocs.power_down()
#!/usr/bin/env python3 from pocs import POCS pocs = POCS(simulator=['camera', 'weather']) pocs.observatory.mount.initialize() pocs.observatory.mount.park() pocs.power_down()
def test_load_bad_state(observatory): pocs = POCS(observatory) with pytest.raises(error.InvalidConfig): pocs._load_state('foo')