Ejemplo n.º 1
0
def test_sp_correction_third_if(NGC4945_continuum,
                                NGC4945_external_continuum_200pc):
    spectrum = NGC4945_external_continuum_200pc.cut_edges(19600, 22900)
    external_spectrum = nd.read_spectrum(TEST_PATH / "cont01.fits", 0,
                                         0.00188).cut_edges(19600, 22900)
    prepared = nd.sp_correction(spectrum, external_spectrum)
    expected_len = len(external_spectrum.spectral_axis)
    assert len(prepared.spectral_axis) == expected_len
Ejemplo n.º 2
0
def test_nplot(fig_test, fig_ref):

    spectrum = (nd.read_spectrum(TEST_PATH / "cont03.fits", 0,
                                 0.00188).cut_edges(19500, 22900).normalize())

    freq_axis = spectrum.frequency_axis
    flux = spectrum.flux

    stella = nd.normalized_blackbody(1100)
    instanstella = stella(freq_axis.value)

    fit_results = NirdustResults(1100 * u.K, "Claire Dunphy", 71, stella,
                                 freq_axis, flux)

    ax_test = fig_test.subplots()
    fit_results.nplot(ax=ax_test)

    ax_ref = fig_ref.subplots()

    ax_ref.plot(freq_axis, flux, color="firebrick", label="continuum")
    ax_ref.plot(freq_axis, instanstella, color="navy", label="model")
    ax_ref.set_xlabel("Frequency [Hz]")
    ax_ref.set_ylabel("Normalized Energy [arbitrary units]")
    ax_ref.legend()
Ejemplo n.º 3
0
def NGC4945_external_continuum_200pc():
    file_name = TEST_PATH / "external_spectrum_200pc_N4945.fits"
    spect = nd.read_spectrum(file_name, 0, 0.00188)
    return spect
Ejemplo n.º 4
0
def NGC4945_continuum_rest_frame():
    file_name = TEST_PATH / "cont03.fits"
    spect = nd.read_spectrum(file_name, 0, 0)
    return spect
Ejemplo n.º 5
0
def NGC4945_continuum():
    file_name = TEST_PATH / "cont03.fits"
    spect = nd.read_spectrum(file_name, 0, 0.00188)
    return spect
Ejemplo n.º 6
0
def test_calibration():
    with pytest.raises(ValueError):
        path = TEST_PATH / "no-calibrated_spectrum.fits"
        nd.read_spectrum(path, 0, 0)