示例#1
0
def test_from_models_mast(tmp_path):
    """Test v1_calculate_from_models for basic running"""
    model = ImageModel()
    model.meta.exposure.start_time = MAST_GOOD_STARTTIME.mjd
    model.meta.exposure.end_time = MAST_GOOD_ENDTIME.mjd

    try:
        v1_table = v1c.v1_calculate_from_models(
            [model],
            method=stp.Methods.COARSE_TR_202111,
            engdb_url=engdb_mast.MAST_BASE_URL)
    except ValueError as exception:
        pytest.xfail(
            f'MAST engineering database not available, possibly no token specified: {exception}'
        )
    v1_formatted = v1c.simplify_table(v1_table)

    # Save for post-test examination
    v1_formatted.write(tmp_path / 'test_from_models_mast.ecsv',
                       format='ascii.ecsv')

    truth = Table.read(DATA_PATH / 'test_from_models_mast.ecsv')
    errors = v1_compare_simplified_tables(v1_formatted, truth)
    errors_str = '\n'.join(errors)
    assert len(errors) == 0, f'V1 tables are different: {errors_str}'
示例#2
0
def test_from_models(engdb):
    """Test v1_calculate_from_models for basic running"""
    model = ImageModel()
    model.meta.exposure.start_time = Time(GOOD_STARTTIME).mjd
    model.meta.exposure.end_time = Time(GOOD_ENDTIME).mjd

    v1_table = v1c.v1_calculate_from_models([model])
    v1_formatted = v1c.simplify_table(v1_table)

    truth = Table.read(DATA_PATH / 'v1_calc_truth.ecsv')
    assert report_diff_values(truth, v1_formatted, fileobj=sys.stderr)
示例#3
0
def test_from_models(engdb_service, tmp_path):
    """Test v1_calculate_from_models for basic running"""
    model = ImageModel()
    model.meta.exposure.start_time = MOCK_GOOD_STARTTIME.mjd
    model.meta.exposure.end_time = MOCK_GOOD_ENDTIME.mjd

    v1_table = v1c.v1_calculate_from_models(
        [model],
        method=stp.Methods.COARSE_TR_202111,
        engdb_url=engdb_service.base_url)
    v1_formatted = v1c.simplify_table(v1_table)

    # Save for post-test examination
    v1_formatted.write(tmp_path / 'test_from_models_service.ecsv',
                       format='ascii.ecsv')

    truth = Table.read(DATA_PATH / 'test_from_models_service.ecsv')
    errors = v1_compare_simplified_tables(v1_formatted, truth)
    errors_str = '\n'.join(errors)
    assert len(errors) == 0, f'V1 tables are different: {errors_str}'