From 7cbab94316317f3da0e02f22d2fcf2821b9a6cbe Mon Sep 17 00:00:00 2001 From: akash5100 Date: Sun, 21 Aug 2022 14:29:23 +0530 Subject: [PATCH 1/5] Add event types enum --- hvpy/__init__.py | 5 +++-- hvpy/events.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 hvpy/events.py diff --git a/hvpy/__init__.py b/hvpy/__init__.py index b3093a5..59fd5bc 100644 --- a/hvpy/__init__.py +++ b/hvpy/__init__.py @@ -1,4 +1,5 @@ -from .facade import * from .config import set_api_url -from .version import __version__ from .datasources import * +from .events import * +from .facade import * +from .version import __version__ diff --git a/hvpy/events.py b/hvpy/events.py new file mode 100644 index 0000000..d0aed1f --- /dev/null +++ b/hvpy/events.py @@ -0,0 +1,30 @@ +from enum import Enum + +__all__ = ["EventType"] + + +class EventType(Enum): + """ + Enum for event types. + """ + + ACTIVE_REGION = "AR" + CORONAL_CAVITY = "CC" + CORONAL_DIMMING = "CD" + CORONAL_HOLE = "CH" + CORONAL_JET = "CJ" + CORONAL_MASS_EJECTION = "CE" + CORONAL_RAIN = "CR" + CORONAL_WAVE = "CW" + EMERGING_FLUX = "EF" + ERUPTION = "ER" + FILAMENT = "FI" + FILAMENT_ACTIVATION = "FA" + FILAMENT_ERUPTION = "FE" + FLARE = "FL" + LOOP = "LP" + OSCILLATION = "OS" + PLAGE = "PG" + SIGMOD = "SG" + SPRAY_SURGE = "SP" + SUNSPOT = "SS" From 70e6b700c7eff648d93d425a9d6eedaba37d8105 Mon Sep 17 00:00:00 2001 From: akash5100 Date: Sun, 21 Aug 2022 14:29:23 +0530 Subject: [PATCH 2/5] Add event types enum --- hvpy/__init__.py | 5 +++-- hvpy/events.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 hvpy/events.py diff --git a/hvpy/__init__.py b/hvpy/__init__.py index 7aebce3..55ab037 100644 --- a/hvpy/__init__.py +++ b/hvpy/__init__.py @@ -1,5 +1,6 @@ -from .facade import * from .config import set_api_url -from .version import __version__ from .datasource import * +from .events import * +from .facade import * from .utils import create_layers +from .version import __version__ diff --git a/hvpy/events.py b/hvpy/events.py new file mode 100644 index 0000000..d0aed1f --- /dev/null +++ b/hvpy/events.py @@ -0,0 +1,30 @@ +from enum import Enum + +__all__ = ["EventType"] + + +class EventType(Enum): + """ + Enum for event types. + """ + + ACTIVE_REGION = "AR" + CORONAL_CAVITY = "CC" + CORONAL_DIMMING = "CD" + CORONAL_HOLE = "CH" + CORONAL_JET = "CJ" + CORONAL_MASS_EJECTION = "CE" + CORONAL_RAIN = "CR" + CORONAL_WAVE = "CW" + EMERGING_FLUX = "EF" + ERUPTION = "ER" + FILAMENT = "FI" + FILAMENT_ACTIVATION = "FA" + FILAMENT_ERUPTION = "FE" + FLARE = "FL" + LOOP = "LP" + OSCILLATION = "OS" + PLAGE = "PG" + SIGMOD = "SG" + SPRAY_SURGE = "SP" + SUNSPOT = "SS" From dce474dd32ac6f3c8bce80beaaadad3914ff5794 Mon Sep 17 00:00:00 2001 From: akash5100 Date: Tue, 23 Aug 2022 15:50:20 +0530 Subject: [PATCH 3/5] Add EventType enum --- docs/api.rst | 3 +++ hvpy/__init__.py | 2 +- hvpy/{events.py => event.py} | 2 +- hvpy/tests/test_event.py | 29 +++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) rename hvpy/{events.py => event.py} (90%) create mode 100644 hvpy/tests/test_event.py diff --git a/docs/api.rst b/docs/api.rst index 3094f86..32ed4b4 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -16,4 +16,7 @@ API Reference .. automodapi:: hvpy.datasource :no-inheritance-diagram: +.. automodapi:: hvpy.event + :no-inheritance-diagram: + .. automodapi:: hvpy.utils diff --git a/hvpy/__init__.py b/hvpy/__init__.py index 55ab037..dbb1156 100644 --- a/hvpy/__init__.py +++ b/hvpy/__init__.py @@ -1,6 +1,6 @@ from .config import set_api_url from .datasource import * -from .events import * +from .event import * from .facade import * from .utils import create_layers from .version import __version__ diff --git a/hvpy/events.py b/hvpy/event.py similarity index 90% rename from hvpy/events.py rename to hvpy/event.py index d0aed1f..fb25a64 100644 --- a/hvpy/events.py +++ b/hvpy/event.py @@ -5,7 +5,7 @@ class EventType(Enum): """ - Enum for event types. + Enum for the event types supported by Helioviewer. """ ACTIVE_REGION = "AR" diff --git a/hvpy/tests/test_event.py b/hvpy/tests/test_event.py new file mode 100644 index 0000000..f5767b9 --- /dev/null +++ b/hvpy/tests/test_event.py @@ -0,0 +1,29 @@ +from hvpy import EventType + +helioviewer_event_types = { + "Active Region": "AR", + "Coronal Cavity": "CC", + "Coronal Dimming": "CD", + "Coronal Hole": "CH", + "Coronal Jet": "CJ", + "Coronal Mass Ejection": "CE", + "Coronal Rain": "CR", + "Coronal Wave": "CW", + "Emerging Flux": "EF", + "Eruption": "ER", + "Filament": "FI", + "Filament Activation": "FA", + "Filament Eruption": "FE", + "Flare": "FL", + "Loop": "LP", + "Oscillation": "OS", + "Plage": "PG", + "Sigmod": "SG", + "Spray Surge": "SP", + "Sunspot": "SS", +} + + +def test_event_types(): + assert [x.value for x in EventType] == list(helioviewer_event_types.values()) + print(list(helioviewer_event_types.values())) From c97cab9b2e4855acba7468df64bc89602993035b Mon Sep 17 00:00:00 2001 From: akash5100 Date: Tue, 23 Aug 2022 15:54:21 +0530 Subject: [PATCH 4/5] remove events module --- hvpy/events.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 hvpy/events.py diff --git a/hvpy/events.py b/hvpy/events.py deleted file mode 100644 index d0aed1f..0000000 --- a/hvpy/events.py +++ /dev/null @@ -1,30 +0,0 @@ -from enum import Enum - -__all__ = ["EventType"] - - -class EventType(Enum): - """ - Enum for event types. - """ - - ACTIVE_REGION = "AR" - CORONAL_CAVITY = "CC" - CORONAL_DIMMING = "CD" - CORONAL_HOLE = "CH" - CORONAL_JET = "CJ" - CORONAL_MASS_EJECTION = "CE" - CORONAL_RAIN = "CR" - CORONAL_WAVE = "CW" - EMERGING_FLUX = "EF" - ERUPTION = "ER" - FILAMENT = "FI" - FILAMENT_ACTIVATION = "FA" - FILAMENT_ERUPTION = "FE" - FLARE = "FL" - LOOP = "LP" - OSCILLATION = "OS" - PLAGE = "PG" - SIGMOD = "SG" - SPRAY_SURGE = "SP" - SUNSPOT = "SS" From 96537ed540100d14ed4b1bf08fabd41290d30a24 Mon Sep 17 00:00:00 2001 From: akash5100 Date: Tue, 23 Aug 2022 15:57:59 +0530 Subject: [PATCH 5/5] remove stdout statement from test --- hvpy/tests/test_event.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hvpy/tests/test_event.py b/hvpy/tests/test_event.py index f5767b9..981a4b5 100644 --- a/hvpy/tests/test_event.py +++ b/hvpy/tests/test_event.py @@ -26,4 +26,3 @@ def test_event_types(): assert [x.value for x in EventType] == list(helioviewer_event_types.values()) - print(list(helioviewer_event_types.values()))