示例#1
0
def test_calculate_xray_luminosity(goeslc):
    # Check correct exceptions are raised to incorrect inputs
    not_goeslc = []
    with pytest.raises(TypeError):
        goes.calculate_xray_luminosity(not_goeslc)
    # Check function gives correct results.
    goeslc_test = goes.calculate_xray_luminosity(goeslc)
    exp_xrsa = u.Quantity([2.8962085e+14, 2.8962085e+14, 2.8962085e+14, 2.8962085e+14,
                           2.8962085e+14], "W")
    exp_xrsb = u.Quantity([5.4654352e+16, 5.3133844e+16, 5.3895547e+16, 5.2375035e+16,
                           5.3895547e+16], "W")
    assert_quantity_allclose(exp_xrsa, goeslc_test.quantity("luminosity_xrsa")[:5])
    assert_quantity_allclose(exp_xrsb, goeslc_test.quantity("luminosity_xrsb")[:5])
示例#2
0
def test_calculate_xray_luminosity():
    # Check correct exceptions are raised to incorrect inputs
    not_goeslc = []
    with pytest.raises(TypeError):
        goes_test = goes.calculate_xray_luminosity(not_goeslc)
    # Check function gives correct results.
    goeslc_input = timeseries.TimeSeries(get_test_filepath("go1520110607.fits"))
    goeslc_test = goes.calculate_xray_luminosity(goeslc_input)
    exp_xrsa = u.Quantity([2.8962085e+14, 2.8962085e+14, 2.8962085e+14, 2.8962085e+14,
                           2.8962085e+14], "W")
    exp_xrsb = u.Quantity([5.4654352e+16, 5.3133844e+16, 5.3895547e+16, 5.2375035e+16,
                           5.3895547e+16], "W")
    assert_quantity_allclose(exp_xrsa, goeslc_test.quantity("luminosity_xrsa")[:5])
    assert_quantity_allclose(exp_xrsb, goeslc_test.quantity("luminosity_xrsb")[:5])
示例#3
0
def test_calculate_xray_luminosity():
    # Check correct exceptions are raised to incorrect inputs
    not_goeslc = []
    with pytest.raises(TypeError):
        goes_test = goes.calculate_xray_luminosity(not_goeslc)
    # Check function gives correct results.
    goeslc_input = lightcurve.GOESLightCurve.create("2014-01-01 00:00:00",
                                                    "2014-01-01 00:00:10")
    goeslc_test = goes.calculate_xray_luminosity(goeslc_input)
    goeslc_expected = copy.deepcopy(goeslc_input)
    goeslc_expected.data["luminosity_xrsa"] = \
      Quantity(np.array([2.49831950e+16, 2.49831950e+16, 2.49831950e+16,
                         2.52864004e+16, 2.49831950e+16], dtype="float32"),
                         unit="J/s")
    goeslc_expected.data["luminosity_xrsb"] = \
      Quantity(np.array([9.54399250e+17, 9.54399250e+17, 9.52985195e+17,
                         9.52985195e+17, 9.51571139e+17], dtype="float32"),
                         unit="J/s")
    assert_frame_equal(goeslc_test.data, goeslc_expected.data)
示例#4
0
def test_calculate_xray_luminosity():
    # Check correct exceptions are raised to incorrect inputs
    not_goeslc = []
    with pytest.raises(TypeError):
        goes_test = goes.calculate_xray_luminosity(not_goeslc)
    # Check function gives correct results.
    goeslc_input = lightcurve.GOESLightCurve.create("2014-01-01 00:00:00",
                                            "2014-01-01 00:00:10")
    goeslc_test = goes.calculate_xray_luminosity(goeslc_input)
    goeslc_expected = copy.deepcopy(goeslc_input)
    goeslc_expected.data["luminosity_xrsa"] = \
      Quantity(np.array([2.49831950e+16, 2.49831950e+16, 2.49831950e+16,
                         2.52864004e+16, 2.49831950e+16], dtype="float32"),
                         unit="J/s")
    goeslc_expected.data["luminosity_xrsb"] = \
      Quantity(np.array([9.54399250e+17, 9.54399250e+17, 9.52985195e+17,
                         9.52985195e+17, 9.51571139e+17], dtype="float32"),
                         unit="J/s")
    assert_frame_equal(goeslc_test.data, goeslc_expected.data)