New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Great Purge mk II #2666
The Great Purge mk II #2666
Conversation
Thanks for the pull request @Cadair! Everything looks great! |
@pep8speaks quiet |
@DanRyanIrish this refactors the goes em code to use timeseries if you want to have a look |
a854cda
to
42aa747
Compare
note to self: I have merged this into the time branch, do not rebase this branch |
Note to self: MERGE IT NOW, PRESS THE BUTTON. |
sunpy/instr/tests/test_lyra.py
Outdated
"CHANNEL2": CHANNELS[1], | ||
"CHANNEL3": CHANNELS[0], | ||
"CHANNEL4": CHANNELS[1]}) | ||
def ts(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a more descriptive function name?
@u.quantity_input(longflux=u.W/u.m/u.m, shortflux=u.W/u.m/u.m) | ||
def _goes_chianti_tem(longflux, shortflux, satellite=8, | ||
@u.quantity_input | ||
def _goes_chianti_tem(longflux: u.W/u.m/u.m, shortflux: u.W/u.m/u.m, satellite=8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax is new to me. Presumably it means longflux
input must be a quantity with equivalent units to u.W/u.m/u.m
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed.
sunpy/instr/goes.py
Outdated
@@ -774,13 +772,13 @@ def calculate_radiative_loss_rate(goeslc, force_download=False, | |||
|
|||
Returns | |||
------- | |||
lc_new : `~sunpy.lightcurve.LightCurve` | |||
lc_new : `~sunpy.timeseries.XRSTimeSeries` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Should be be ts_new
sunpy/instr/goes.py
Outdated
2014-01-01 00:00:04.518999 9.187300e-08 0.000004 2.498454e+16 9.530365e+17 | ||
2014-01-01 00:00:06.564999 9.298800e-08 0.000004 2.528776e+16 9.530365e+17 | ||
>>> import sunpy.timeseries as ts | ||
>>> from sunpy.instr.goes import calculate_temperature_em |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be >>> from sunpy.instr.goes import calculate_xray_luminosity
sunpy/instr/goes.py
Outdated
data=copy.deepcopy(goeslc.data)) | ||
lc_new.data["luminosity_xrsa"] = lx_out["shortlum"].to("W").value | ||
lc_new.data["luminosity_xrsb"] = lx_out["longlum"].to("W").value | ||
lc_new = timeseries.XRSTimeSeries(meta=copy.deepcopy(goests.meta), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lc_new
should be ts_new
here.
sunpy/instr/goes.py
Outdated
lc_new = timeseries.XRSTimeSeries(meta=copy.deepcopy(goests.meta), | ||
data=copy.deepcopy(goests.data), | ||
units=copy.deepcopy(goests.units)) | ||
lc_new = lc_new.add_column("luminosity_xrsa", lx_out["shortlum"].to("W")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lc_new
should be ts_new
here.
sunpy/instr/goes.py
Outdated
data=copy.deepcopy(goests.data), | ||
units=copy.deepcopy(goests.units)) | ||
lc_new = lc_new.add_column("luminosity_xrsa", lx_out["shortlum"].to("W")) | ||
lc_new = lc_new.add_column("luminosity_xrsb", lx_out["longlum"].to("W")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lc_new
should be ts_new
here.
sunpy/instr/goes.py
Outdated
data=copy.deepcopy(goests.data), | ||
units=copy.deepcopy(goests.units)) | ||
lc_new = lc_new.add_column("luminosity_xrsa", lx_out["shortlum"].to("W")) | ||
lc_new = lc_new.add_column("luminosity_xrsb", lx_out["longlum"].to("W")) | ||
|
||
return lc_new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lc_new
should be ts_new
here.
|
||
# Test case 2: GOESLightCurve object with flux and temperature | ||
# data, but no EM data. | ||
goes_test = goes.calculate_radiative_loss_rate(goeslc_no_em) | ||
assert_frame_equal(goeslc_test.data, goeslc_expected.data) | ||
# we test that the column has been added | ||
assert "rad_loss_rate" in goes_test.columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we only test the column is added here and not that the values are correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done using pytest-arraydiff
sunpy/instr/tests/test_lyra.py
Outdated
return lyrats | ||
|
||
|
||
@pytest.mark.remote_data | ||
@pytest.mark.parametrize('dtype', ['ts', 'lc']) | ||
def test_remove_lytaf_events_from_timeseries(dtype): | ||
def test_remove_lytaf_events_from_timeseries(ts): | ||
"""Test if artefacts are correctly removed from a TimeSeries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstring probably needs updating so it's clear what the input is. The mention of the LYRALightCurve
can probably go too.
Now that all the lightcurve sources have been removed, can you remind me how |
.circleci/early_exit.sh
Outdated
#!/bin/bash | ||
|
||
commitmessage=$(git log --pretty=%B -n 1) | ||
if [[ $commitmessage = *"[ci skip]"* ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis supports both [skip ci]
and [ci skip]
. Personally I prefer, [skip ci]
. Shouldn't we support both?
sunpy/instr/goes.py
Outdated
@@ -754,8 +752,8 @@ def calculate_radiative_loss_rate(goeslc, force_download=False, | |||
|
|||
Parameters | |||
---------- | |||
goeslc : `~sunpy.lightcurve.LightCurve` | |||
LightCurve object containing GOES data. The units of these | |||
goeslc : `~sunpy.timeseries.XRSTimeSeries` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed ts here.
sunpy/instr/tests/test_goes.py
Outdated
@@ -67,17 +67,17 @@ def test_goes_event_list(): | |||
def test_calculate_temperature_em(): | |||
# Create GOESLightcurve object, then create new one with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment and the rest of the function needs updating.
@DanRyanIrish yes if it can be autodetected, i.e. its not a csv file, there is also a |
This deletes all the deprecated submodules for 1.0