Exemplo n.º 1
0
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()
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
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()
Exemplo n.º 7
0
 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()
Exemplo n.º 8
0
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()
Exemplo n.º 9
0
 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()
Exemplo n.º 10
0
def test_bad_state_machine_file():
    with pytest.raises(error.InvalidConfig):
        POCS.load_state_table(state_table_name='foo')
Exemplo n.º 11
0
#!/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()
Exemplo n.º 12
0
#!/usr/bin/env python3

from pocs import POCS

pocs = POCS(simulator=['camera', 'weather'])
pocs.observatory.mount.initialize()
pocs.observatory.mount.park()
pocs.power_down()
Exemplo n.º 13
0
def test_load_bad_state(observatory):
    pocs = POCS(observatory)

    with pytest.raises(error.InvalidConfig):
        pocs._load_state('foo')
Exemplo n.º 14
0
def test_bad_state_machine_file():
    with pytest.raises(error.InvalidConfig):
        POCS.load_state_table(state_table_name='foo')