Skip to content
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

Merged
merged 12 commits into from Jul 19, 2018
Merged

The Great Purge mk II #2666

merged 12 commits into from Jul 19, 2018

Conversation

Cadair
Copy link
Member

@Cadair Cadair commented Jun 20, 2018

This deletes all the deprecated submodules for 1.0

@ghost
Copy link

ghost commented Jun 20, 2018

Thanks for the pull request @Cadair! Everything looks great!

@sunpy sunpy deleted a comment from pep8speaks Jun 20, 2018
@Cadair
Copy link
Member Author

Cadair commented Jun 20, 2018

@pep8speaks quiet

@Cadair Cadair added this to the 1.0 milestone Jun 20, 2018
@Cadair Cadair added the Refactoring Code changes without affecting API (generally) label Jun 20, 2018
@Cadair Cadair added the Needs Review Needs reviews before merge label Jun 20, 2018
@Cadair Cadair requested a review from DanRyanIrish June 20, 2018 22:01
@Cadair
Copy link
Member Author

Cadair commented Jun 20, 2018

@DanRyanIrish this refactors the goes em code to use timeseries if you want to have a look

@Cadair Cadair force-pushed the removalmk2 branch 2 times, most recently from a854cda to 42aa747 Compare June 22, 2018 13:06
@Cadair
Copy link
Member Author

Cadair commented Jun 27, 2018

note to self: I have merged this into the time branch, do not rebase this branch

@nabobalis
Copy link
Contributor

Note to self: MERGE IT NOW, PRESS THE BUTTON.

"CHANNEL2": CHANNELS[1],
"CHANNEL3": CHANNELS[0],
"CHANNEL4": CHANNELS[1]})
def ts():
Copy link
Member

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,
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed.

@@ -774,13 +772,13 @@ def calculate_radiative_loss_rate(goeslc, force_download=False,

Returns
-------
lc_new : `~sunpy.lightcurve.LightCurve`
lc_new : `~sunpy.timeseries.XRSTimeSeries`
Copy link
Member

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

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
Copy link
Member

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

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),
Copy link
Member

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.

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"))
Copy link
Member

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.

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"))
Copy link
Member

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.

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
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done using pytest-arraydiff

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.
Copy link
Member

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.

@DanRyanIrish
Copy link
Member

Now that all the lightcurve sources have been removed, can you remind me how TimeSeries handles different sources? It's a factory-like setup like Map which detects the source from the input file?

#!/bin/bash

commitmessage=$(git log --pretty=%B -n 1)
if [[ $commitmessage = *"[ci skip]"* ]]; then
Copy link
Member

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?

@@ -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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed ts here.

@@ -67,17 +67,17 @@ def test_goes_event_list():
def test_calculate_temperature_em():
# Create GOESLightcurve object, then create new one with
Copy link
Member

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.

@Cadair Cadair mentioned this pull request Jul 18, 2018
2 tasks
@Cadair
Copy link
Member Author

Cadair commented Jul 18, 2018

@DanRyanIrish yes if it can be autodetected, i.e. its not a csv file, there is also a format= kwarg for when it cant be auto detected.

@Cadair Cadair merged commit 98cced8 into sunpy:master Jul 19, 2018
@Cadair Cadair deleted the removalmk2 branch July 19, 2018 10:29
@nabobalis nabobalis added this to Finished in SunPy 1.0 Sep 24, 2018
@dstansby dstansby removed the Needs Review Needs reviews before merge label Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Code changes without affecting API (generally)
Projects
No open projects
SunPy 1.0
  
Finished
Development

Successfully merging this pull request may close these issues.

None yet

5 participants