PyThea 0.10.0__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. pythea-0.12.0/.readthedocs.yaml +29 -0
  2. {pythea-0.10.0 → pythea-0.12.0}/CHANGELOG.md +35 -0
  3. {pythea-0.10.0/PyThea.egg-info → pythea-0.12.0}/PKG-INFO +6 -5
  4. {pythea-0.10.0 → pythea-0.12.0}/PyThea/PyThea_app.py +45 -20
  5. {pythea-0.10.0 → pythea-0.12.0}/PyThea/_version.py +2 -2
  6. {pythea-0.10.0 → pythea-0.12.0}/PyThea/config/app_styles.py +0 -5
  7. pythea-0.12.0/PyThea/config/selected_imagers.py +65 -0
  8. pythea-0.12.0/PyThea/data/sample_data.py +35 -0
  9. {pythea-0.10.0 → pythea-0.12.0}/PyThea/pythea_cli.py +21 -2
  10. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/map/maputils.py +7 -2
  11. pythea-0.12.0/PyThea/test/figure_hashes.json +7 -0
  12. pythea-0.12.0/PyThea/test/test_figures.py +196 -0
  13. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/test_imports.py +4 -1
  14. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/test_remote_clients.py +2 -2
  15. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/test_utils.py +47 -3
  16. {pythea-0.10.0 → pythea-0.12.0}/PyThea/utils.py +96 -33
  17. {pythea-0.10.0 → pythea-0.12.0/PyThea.egg-info}/PKG-INFO +6 -5
  18. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/SOURCES.txt +3 -0
  19. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/requires.txt +2 -1
  20. {pythea-0.10.0 → pythea-0.12.0}/README.md +3 -3
  21. {pythea-0.10.0 → pythea-0.12.0}/README_pypi.md +3 -3
  22. {pythea-0.10.0 → pythea-0.12.0}/environment.yml +2 -1
  23. {pythea-0.10.0 → pythea-0.12.0}/requirements.txt +2 -1
  24. {pythea-0.10.0 → pythea-0.12.0}/setup.cfg +4 -0
  25. pythea-0.10.0/PyThea/config/selected_imagers.py +0 -34
  26. pythea-0.10.0/PyThea/data/sample_data.py +0 -15
  27. {pythea-0.10.0 → pythea-0.12.0}/LICENSE.md +0 -0
  28. {pythea-0.10.0 → pythea-0.12.0}/MANIFEST.in +0 -0
  29. {pythea-0.10.0 → pythea-0.12.0}/PyThea/__init__.py +0 -0
  30. {pythea-0.10.0 → pythea-0.12.0}/PyThea/callbacks.py +0 -0
  31. {pythea-0.10.0 → pythea-0.12.0}/PyThea/config/__init__.py +0 -0
  32. {pythea-0.10.0 → pythea-0.12.0}/PyThea/config/config_sliders.py +0 -0
  33. {pythea-0.10.0 → pythea-0.12.0}/PyThea/config/selected_bodies.py +0 -0
  34. {pythea-0.10.0 → pythea-0.12.0}/PyThea/data/__init__.py +0 -0
  35. {pythea-0.10.0 → pythea-0.12.0}/PyThea/extensions/LICENSE_gcs_python.md +0 -0
  36. {pythea-0.10.0 → pythea-0.12.0}/PyThea/extensions/__init__.py +0 -0
  37. {pythea-0.10.0 → pythea-0.12.0}/PyThea/extensions/buttons.py +0 -0
  38. {pythea-0.10.0 → pythea-0.12.0}/PyThea/geometrical_models.py +0 -0
  39. {pythea-0.10.0 → pythea-0.12.0}/PyThea/modules.py +0 -0
  40. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/__init__.py +0 -0
  41. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/__init__.py +0 -0
  42. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/__init__.py +0 -0
  43. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/aia/__init__.py +0 -0
  44. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/aia/utils.py +0 -0
  45. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/lasco/__init__.py +0 -0
  46. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/lasco/utils.py +0 -0
  47. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/stereo/__init__.py +0 -0
  48. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/extern/sunkit_instruments/stereo/utils.py +0 -0
  49. {pythea-0.10.0 → pythea-0.12.0}/PyThea/sunpy_dev/map/__init__.py +0 -0
  50. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/Pythea_test.py +0 -0
  51. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/__init__.py +0 -0
  52. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/conftest.py +0 -0
  53. {pythea-0.10.0 → pythea-0.12.0}/PyThea/test/test_geometrical_models.py +0 -0
  54. {pythea-0.10.0 → pythea-0.12.0}/PyThea/version.py +0 -0
  55. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/.DS_Store +0 -0
  56. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/dependency_links.txt +0 -0
  57. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/entry_points.txt +0 -0
  58. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/not-zip-safe +0 -0
  59. {pythea-0.10.0 → pythea-0.12.0}/PyThea.egg-info/top_level.txt +0 -0
  60. {pythea-0.10.0 → pythea-0.12.0}/pyproject.toml +0 -0
  61. {pythea-0.10.0 → pythea-0.12.0}/setup.py +0 -0
@@ -0,0 +1,29 @@
1
+ # .readthedocs.yaml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Set the version of Python and other tools you might need
9
+ build:
10
+ os: ubuntu-22.04
11
+ tools:
12
+ python: "3.9"
13
+ # You can also specify other tool versions:
14
+ # nodejs: "16"
15
+ # rust: "1.55"
16
+ # golang: "1.17"
17
+
18
+ # Build documentation in the docs/ directory with Sphinx
19
+ sphinx:
20
+ configuration: docs/source/conf.py
21
+
22
+ # If using Sphinx, optionally build your docs in additional formats such as PDF
23
+ # formats:
24
+ # - pdf
25
+
26
+ # Optionally declare the Python requirements required to build your docs
27
+ python:
28
+ install:
29
+ - requirements: docs/source/requirements.txt
@@ -1,3 +1,38 @@
1
+ # v0.12.0 (09-Jun-2024)
2
+
3
+ ## Features
4
+ - Adds more imaging data from SDO/AIA.
5
+ - Adds acceleration calculation in the kinematic plots.
6
+ - Implements acceleration plotting in the app.
7
+ - Includes fits file name in fitting files and dataframes.
8
+ - Highlights a row in the fitting table when fitting exist in table.
9
+
10
+ ## Major Changes
11
+ - Decouples the loading of fits files from download_fits function.
12
+
13
+ ## Minor Changes
14
+ - Improves configuration dictionary for selected imagers.
15
+ - Improves json warning message in the main app page.
16
+ - Adds documentation page link to the main app page.
17
+ - Updates README files.
18
+ - Improves plot_fitting_model and adds figure test.
19
+ - Improves application layout.
20
+
21
+ ## Bug Fixes
22
+ - Fixes a potential bug in filter_maps when no filtering is applied.
23
+ - Fixes a bug with progress bar with stqdm.
24
+ - Fixes a bug with image processing mode selection.
25
+
26
+ # v0.11.0 (19-May-2024)
27
+
28
+ ## Features
29
+ - Adds tests for ellipsoid location on AIA and STEREO COR images.
30
+ - Adds test_load_fitting_json_file to check the fitting file load and save.
31
+ - Improve PyThea tests on cli.
32
+
33
+ ## Major Changes
34
+ - Change the inputs for download_fits from string dates to timerange.
35
+
1
36
  # v0.10.0 (17-April-2024)
2
37
 
3
38
  ## Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyThea
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Summary: PyThea: A software package to reconstruct the 3D structure of CMEs and shock waves
5
5
  Home-page: https://github.com/AthKouloumvakos/PyThea
6
6
  Author: Athanasios Kouloumvakos
@@ -26,6 +26,7 @@ Requires-Dist: scipy
26
26
  Requires-Dist: aiapy
27
27
  Requires-Dist: astropy
28
28
  Requires-Dist: astroquery
29
+ Requires-Dist: jplephem
29
30
  Requires-Dist: numexpr
30
31
  Requires-Dist: sunpy==5.1.2
31
32
  Requires-Dist: parfive==2.1.0
@@ -34,7 +35,6 @@ Requires-Dist: matplotlib
34
35
  Requires-Dist: seaborn
35
36
  Requires-Dist: streamlit
36
37
  Requires-Dist: Pillow
37
- Requires-Dist: stqdm
38
38
  Requires-Dist: lxml
39
39
  Requires-Dist: zeep
40
40
  Requires-Dist: drms
@@ -42,6 +42,7 @@ Requires-Dist: tqdm
42
42
  Requires-Dist: pyvista
43
43
  Requires-Dist: pytest-astropy
44
44
  Requires-Dist: pytest-sugar
45
+ Requires-Dist: pytest-mpl
45
46
 
46
47
  # PyThea: A software package to reconstruct the 3D structure of CMEs and shock waves
47
48
 
@@ -61,8 +62,8 @@ We recommend, creating a virtual environment for _PyThea_ and installing the pac
61
62
  If you use Anaconda or Miniconda (which we also recommend) you can create a virtual environment using ```conda``` and then install _PyThea_ using from PyPI using ```pip```. In the terminal do the following:
62
63
 
63
64
  ```python
64
- # Create a virtual environment. Use python=3.8 or 3.9
65
- conda create --name PyThea python=3.9
65
+ # Create a virtual environment. Use python>3.9
66
+ conda create --name PyThea python=3.10
66
67
 
67
68
  # Activate the environment
68
69
  conda activate PyThea
@@ -136,7 +137,7 @@ If there is an error when running ```PyThea streamlit``` then you can manually r
136
137
 
137
138
  ## 📙 Usage
138
139
 
139
- Complete documentation of the _PyThea_ is under construction.
140
+ Complete documentation of the _PyThea_ can be found in [https://www.pythea.org/](https://www.pythea.org/).
140
141
 
141
142
  ## 📦 Useful Python packages
142
143
 
@@ -18,14 +18,15 @@
18
18
  """
19
19
 
20
20
 
21
+ import datetime
21
22
  from copy import copy
22
23
 
23
24
  import astropy.units as u
24
25
  import numpy as np
25
- import stqdm # See also https://github.com/tqdm/tqdm
26
26
  import streamlit as st
27
27
  from astropy.coordinates import Distance, SkyCoord, SphericalRepresentation
28
28
  from sunpy.coordinates import frames
29
+ from sunpy.net import attrs as a
29
30
 
30
31
  from PyThea.callbacks import load_or_delete_fittings
31
32
  from PyThea.config import (app_styles, config_sliders, selected_bodies,
@@ -36,8 +37,8 @@ from PyThea.modules import (date_and_event_selection, figure_streamlit,
36
37
  fitting_and_slider_options_container,
37
38
  fitting_sliders)
38
39
  from PyThea.sunpy_dev.map.maputils import get_closest, maps_clims
39
- from PyThea.utils import (download_fits, model_fittings, plot_fitting_model,
40
- single_imager_maps_process)
40
+ from PyThea.utils import (download_fits, load_fits, model_fittings,
41
+ plot_fitting_model, single_imager_maps_process)
41
42
  from PyThea.version import version
42
43
 
43
44
 
@@ -47,6 +48,13 @@ def delete_from_state(vars):
47
48
  del st.session_state[var]
48
49
 
49
50
 
51
+ def highlight_row(row, row_index):
52
+ if row.name.strftime('%Y-%m-%dT%H:%M:%S.%f') == row_index.strftime('%Y-%m-%dT%H:%M:%S.%f').values[0]:
53
+ return ['background-color: lightpink']*len(row)
54
+ else:
55
+ return ['']*len(row)
56
+
57
+
50
58
  def footer_text():
51
59
  st.subheader('About this application:')
52
60
  st.markdown("""
@@ -63,16 +71,23 @@ def footer_text():
63
71
  right.markdown("""
64
72
  **Github**: Find the latest version here
65
73
  [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/AthKouloumvakos/PyThea) \n
66
- **Citation**: Cite PyThea as [![https://doi.org/10.5281/zenodo.5713659](https://zenodo.org/badge/DOI/10.5281/zenodo.5713659.svg)](https://doi.org/10.5281/zenodo.5713659) \n
74
+ **Documentation Page**: https://www.pythea.org/
67
75
  """ +
68
76
  f"""
69
77
  **Version**: {version} (latest release [![Version](https://img.shields.io/github/v/release/AthKouloumvakos/PyThea)](https://github.com/AthKouloumvakos/PyThea/releases))
70
78
  """)
71
79
  left.image('https://github.com/AthKouloumvakos/PyThea/blob/master/docs/logo/pythea_logo.png?raw=true')
80
+ st.markdown("""
81
+ **Citation**: Please cite the following paper [![https://www.frontiersin.org/articles/10.3389/fspas.2022.974137/](https://img.shields.io/static/v1?label=Paper&message=Frontiers&color=red)](https://www.frontiersin.org/articles/10.3389/fspas.2022.974137/) and [![https://doi.org/10.5281/zenodo.5713659](https://zenodo.org/badge/DOI/10.5281/zenodo.5713659.svg)](https://doi.org/10.5281/zenodo.5713659)
82
+ """)
83
+ st.info('''
84
+ More imaging data have been added:
85
+ - SDO/AIA images from 211A channel have been added.
86
+ ''', icon='ℹ️')
72
87
  st.warning('''
73
- ⚠️ **NOTE: From PyThea >0.8.1 the JSON fitting files will be slightly different from the old ones.** ⚠️
74
- * Due to a change in the fitting time input, the new fitting files may have slightly different times for the same images (see further information [here](https://github.com/AthKouloumvakos/PyThea/discussions/24)).
75
- ''')
88
+ **NOTE: From PyThea >0.8.1 the JSON fitting files will be slightly different from the old ones.**
89
+ Due to a change in the fitting time input, the new fitting files may have slightly different times for the same images (see further information [here](https://github.com/AthKouloumvakos/PyThea/discussions/24)).
90
+ ''', icon='⚠️')
76
91
  st.markdown('---')
77
92
 
78
93
 
@@ -84,7 +99,10 @@ def run():
84
99
  #############################################################
85
100
  # set page config
86
101
  st.set_page_config(page_title='PyThea', page_icon=':rocket:',
87
- initial_sidebar_state='expanded')
102
+ initial_sidebar_state='expanded',
103
+ menu_items={
104
+ 'Get Help': 'https://www.pythea.org/',
105
+ 'Report a Bug': 'https://github.com/AthKouloumvakos/PyThea'})
88
106
 
89
107
  #############################################################
90
108
  # HTML Styles
@@ -92,7 +110,7 @@ def run():
92
110
 
93
111
  #############################################################
94
112
  # Main page information text
95
- st.title('PyThea: Reconstruct CMEs & Shocks')
113
+ st.header('PyThea: Reconstruct CMEs & Shocks')
96
114
 
97
115
  #############################################################
98
116
  # Startup Variables
@@ -104,7 +122,6 @@ def run():
104
122
 
105
123
  if 'date_process' not in st.session_state:
106
124
  date_and_event_selection(st)
107
- st.markdown(""" #### ⏻ Select a day & solar event. """)
108
125
  else:
109
126
  st.sidebar.markdown('## Processing Event|Date:')
110
127
  st.sidebar.info(f'{st.session_state.event_selected}')
@@ -192,7 +209,8 @@ def run():
192
209
  on_change=delete_from_state,
193
210
  kwargs={'vars': ['map', 'imagers_list_', 'clim', 'clim_manual_low', 'clim_manual_high']})
194
211
  if image_mode in ['Running Diff.', 'Base Diff.']:
195
- diff_value = procoption_container.number_input('Select Step/Image for Running/Base Diff.', 1, 5, key='diff_value',
212
+ min_diff = 1 if image_mode == 'Running Diff.' else 0
213
+ diff_value = procoption_container.number_input('Select Step/Image for Running/Base Diff.', min_diff, 5, key='diff_value',
196
214
  on_change=delete_from_state,
197
215
  kwargs={'vars': ['map', 'imagers_list_', 'clim', 'clim_manual_low', 'clim_manual_high']})
198
216
  else:
@@ -243,14 +261,16 @@ def run():
243
261
  st.session_state.map_ = {} if 'map_' not in st.session_state else st.session_state.map_
244
262
  st.session_state.map = {} if 'map' not in st.session_state else st.session_state.map
245
263
  st.session_state['imagers_list_'] = imagers_list
246
- progress_bar = stqdm.stqdm(imager_added, desc='Preparing to Download data')
247
- for imager in progress_bar:
248
- progress_bar.desc = f'Downloaded {imager} images from VSO'
264
+ progress_bar = st.progress(0, text='Preparing to Download data')
265
+ for i, imager in enumerate(imager_added):
266
+ progress_bar.progress(i/len(imager_added), text=f'Download {imager} images from VSO')
249
267
  if imager not in st.session_state.map_:
250
- st.session_state.map_[imager] = download_fits(st.session_state.date_process,
251
- imager, time_range=imaging_time_range)
268
+ timerange = a.Time(st.session_state.date_process + datetime.timedelta(hours=imaging_time_range[0]),
269
+ st.session_state.date_process + datetime.timedelta(hours=imaging_time_range[1]))
270
+ downloaded_files = download_fits(timerange, imager)
271
+ st.session_state.map_[imager] = load_fits(downloaded_files)
252
272
  st.session_state.map_[imager] = single_imager_maps_process(st.session_state.map_[imager],
253
- **selected_imagers.imager_dict[imager][1],
273
+ **selected_imagers.imager_dict[imager]['process'],
254
274
  skip='sequence_processing')
255
275
  processed_images = single_imager_maps_process(st.session_state.map_[imager],
256
276
  skip=['filter', 'prepare'],
@@ -262,6 +282,7 @@ def run():
262
282
  else:
263
283
  st.session_state.imagers_list_.remove(imager)
264
284
  st.session_state.map_colormap_limits.pop(imager, None)
285
+ progress_bar.empty()
265
286
 
266
287
  if imager_removed != []:
267
288
  st.session_state['imagers_list_'] = imagers_list
@@ -371,6 +392,7 @@ def run():
371
392
  # Store the fitting
372
393
  single_fit = model.to_dataframe()
373
394
  single_fit['imager'] = imager_select
395
+ single_fit['fits_file'] = running_map.meta['fits_file']
374
396
 
375
397
  if store_fit_button_pressed:
376
398
  if 'model_fittings' not in st.session_state:
@@ -387,10 +409,13 @@ def run():
387
409
  st.markdown('---')
388
410
  st.markdown('### Parameters Table')
389
411
  st.markdown('**Running Fitting Table:**')
390
- st.dataframe(single_fit)
412
+ col_formats = {col: '{:,.2f}'.format for col in single_fit.select_dtypes(include='number').columns}
413
+ st.dataframe(single_fit.style.format(col_formats))
391
414
  if 'model_fittings' in st.session_state:
392
415
  st.markdown('**Stored Fitting Table:**')
393
- st.dataframe(st.session_state.model_fittings.parameters)
416
+ st.dataframe(st.session_state.model_fittings.parameters.style.apply(highlight_row,
417
+ row_index=single_fit.index, axis=1).format(col_formats)
418
+ )
394
419
  col1, col2 = st.columns((2, 2))
395
420
  col2.selectbox('Select a fitting',
396
421
  options=st.session_state.model_fittings.parameters.index,
@@ -410,7 +435,7 @@ def run():
410
435
  st.markdown('### Plots of kinematics ')
411
436
  col1, col2, col3 = st.columns(3)
412
437
  plt_kinematics_select = col1.selectbox('Select Plots',
413
- options=['All', 'HeightT', 'SpeedT', 'Long-LatT'])
438
+ options=['All', 'HeightT', 'SpeedT', 'AccelerationT', 'Long-LatT'])
414
439
 
415
440
  fit_mode = col2.selectbox('Select Fitting Mode',
416
441
  options=['polynomial', 'spline', 'custom'],
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.10.0'
16
- __version_tuple__ = version_tuple = (0, 10, 0)
15
+ __version__ = version = '0.12.0'
16
+ __version_tuple__ = version_tuple = (0, 12, 0)
@@ -1,9 +1,4 @@
1
1
  def apply(st):
2
- # Hide the menu button
3
- st.markdown(""" <style>
4
- #MainMenu {visibility: hidden;}
5
- footer {visibility: hidden;}
6
- </style> """, unsafe_allow_html=True)
7
2
  # Do some css styling tricks here (e.g. remove the padding)
8
3
  # https://discuss.streamlit.io/t/reduce-white-space-top-of-the-page/21737/3
9
4
  st.markdown("""
@@ -0,0 +1,65 @@
1
+ '''
2
+ A dictionary of the selected imagers
3
+ How to use this:
4
+
5
+ '''
6
+ import astropy.units as u
7
+ from sunpy.net import attrs as a
8
+
9
+ imager_dict = {}
10
+
11
+ imager_dict['LC2'] = {'fido': (a.Instrument.lasco, a.Detector.c2),
12
+ 'process': {'dimensions': (1024*u.pixel, 1024*u.pixel), 'polar': 'Clear', 'superpixel': 2},
13
+ 'source': 'SOHO', 'instrument': 'LASCO', 'detector': 'C2'}
14
+
15
+ imager_dict['LC3'] = {'fido': (a.Instrument.lasco, a.Detector.c3),
16
+ 'process': {'dimensions': (1024*u.pixel, 1024*u.pixel), 'polar': 'Clear', 'superpixel': 2},
17
+ 'source': 'SOHO', 'instrument': 'LASCO', 'detector': 'C3'}
18
+
19
+ imager_dict['AIA-193'] = {'fido': (a.Instrument.aia, a.Wavelength(19.3 * u.nm), a.Sample(1*u.minute)),
20
+ 'process': {'dimensions': (4096*u.pixel, 4096*u.pixel), 'superpixel': 8, 'exposure': 1.90},
21
+ 'source': 'SDO', 'instrument': 'AIA', 'wavelength': '193'}
22
+
23
+ imager_dict['AIA-211'] = {'fido': (a.Instrument.aia, a.Wavelength(21.1 * u.nm), a.Sample(1*u.minute)),
24
+ 'process': {'dimensions': (4096*u.pixel, 4096*u.pixel), 'superpixel': 8, 'exposure': 1.90},
25
+ 'source': 'SDO', 'instrument': 'AIA', 'wavelength': '211'}
26
+
27
+ imager_dict['COR2A'] = {'fido': (a.Source('STEREO_A'), a.Detector.cor2),
28
+ 'process': {'dimensions': (2048*u.pixel, 2048*u.pixel), 'polar': 1001, 'superpixel': 4},
29
+ 'source': 'STEREO_A', 'instrument': 'SECCHI', 'detector': 'COR2'}
30
+
31
+ imager_dict['COR2B'] = {'fido': (a.Source('STEREO_B'), a.Detector.cor2),
32
+ 'process': {'dimensions': (2048*u.pixel, 2048*u.pixel), 'polar': 1001, 'superpixel': 4},
33
+ 'source': 'STEREO_B', 'instrument': 'SECCHI', 'detector': 'COR2'}
34
+
35
+ imager_dict['EUVIA'] = {'fido': (a.Source('STEREO_A'), a.Detector.euvi, a.Wavelength(19.5 * u.nm)),
36
+ 'process': {'dimensions': (2048*u.pixel, 2048*u.pixel), 'superpixel': 4},
37
+ 'source': 'STEREO_A', 'instrument': 'SECCHI', 'detector': 'EUVI'}
38
+
39
+ imager_dict['EUVIB'] = {'fido': (a.Source('STEREO_B'), a.Detector.euvi, a.Wavelength(19.5 * u.nm)),
40
+ 'process': {'dimensions': (2048*u.pixel, 2048*u.pixel), 'superpixel': 4},
41
+ 'source': 'STEREO_B', 'instrument': 'SECCHI', 'detector': 'EUVI'}
42
+
43
+ imager_dict['COR1A'] = {'fido': (a.Source('STEREO_A'), a.Detector.cor1),
44
+ 'process': {'dimensions': (512*u.pixel, 512*u.pixel)},
45
+ 'source': 'STEREO_A', 'instrument': 'SECCHI', 'detector': 'COR1'}
46
+
47
+ imager_dict['COR1B'] = {'fido': (a.Source('STEREO_B'), a.Detector.cor1),
48
+ 'process': {'dimensions': (512*u.pixel, 512*u.pixel)},
49
+ 'source': 'STEREO_B', 'instrument': 'SECCHI', 'detector': 'COR1'}
50
+
51
+ imager_dict['HI1A'] = {'fido': (a.Source('STEREO_A'), a.Detector.hi1),
52
+ 'process': {'dimensions': (1024*u.pixel, 1024*u.pixel), 'superpixel': 2},
53
+ 'source': 'STEREO_A', 'instrument': 'SECCHI', 'detector': 'HI1'}
54
+
55
+ imager_dict['HI1B'] = {'fido': (a.Source('STEREO_B'), a.Detector.hi1),
56
+ 'process': {'dimensions': (1024*u.pixel, 1024*u.pixel), 'superpixel': 2},
57
+ 'source': 'STEREO_B', 'instrument': 'SECCHI', 'detector': 'HI1'}
58
+
59
+ imager_dict['HI2A'] = {'fido': (a.Source('STEREO_A'), a.Detector.hi2),
60
+ 'process': {'dimensions': (1024*u.pixel, 1024*u.pixel), 'superpixel': 2},
61
+ 'source': 'STEREO_A', 'instrument': 'SECCHI', 'detector': 'HI2'}
62
+
63
+ imager_dict['HI2B'] = {'fido': (a.Source('STEREO_B'), a.Detector.hi2),
64
+ 'process': {'dimensions': (1024*u.pixel, 1024*u.pixel), 'superpixel': 2},
65
+ 'source': 'STEREO_B', 'instrument': 'SECCHI', 'detector': 'HI2'}
@@ -0,0 +1,35 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+ import pooch
5
+
6
+ database_dir = os.path.join(Path.home(), 'PyThea')
7
+ github_main_url = 'https://github.com/AthKouloumvakos/PyThea-sample-data'
8
+
9
+ aia_sample_data = pooch.create(
10
+ path=os.path.join(database_dir, 'sample_data'), # The cache folder
11
+ base_url=f'{github_main_url}/raw/main/data/', # The remote data url on Github
12
+ registry={
13
+ 'aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits': 'sha256:7e88d8a277ad3dd111c1bcff3c3936d6d5ef5186e05b4bfa7749ee43c05577d5',
14
+ 'aia_lev1_1600a_2016_05_09t11_35_51_12z_image_lev1.fits': 'sha256:1c3bb938e9bfb3178cecead1319a92fa661eb70469715a441a849a98039f0b61'
15
+ },
16
+ )
17
+
18
+ stereo_sample_data = pooch.create(
19
+ path=os.path.join(database_dir, 'sample_data'), # The cache folder
20
+ base_url=f'{github_main_url}/raw/main/data/', # The remote data url on Github
21
+ registry={
22
+ '20120622_235400_d4c2a.fts': 'sha256:940680fe8bea754c9859170585d8299b9b049b631155435a31ecacf5b702d9cf',
23
+ '20140221_235400_d4c2b.fts': 'sha256:13638dedeb2e510c9e2ef11d46b372acb16f9b9645ca1cabf4d0ef8444353adc',
24
+ '20070503_102018_s4c1a.fts': 'sha256:55cf6e3741833a82e41b46e2345bf85a0e5580a2832900eccc41f235d36fc31e',
25
+ '20070503_102018_s4c1b.fts': 'sha256:ca8f4aabaeb7e4bc6f4e5d4819057ddfe3f9f621716224d11acc80d701e3beb8'
26
+ },
27
+ )
28
+
29
+ json_fitting_file_sample_data = pooch.create(
30
+ path=os.path.join(database_dir, 'sample_data'), # The cache folder
31
+ base_url=f'{github_main_url}/raw/main/data/', # The remote data url on Github
32
+ registry={
33
+ 'FLX1p0D20211028T153500MEllipsoid.json': 'sha256:34fced8530875110117ba27a73541d3acd0c90bc8fca99367c1ec4cdfc05ce86',
34
+ },
35
+ )
@@ -99,9 +99,28 @@ def update():
99
99
 
100
100
 
101
101
  @main.command('test')
102
- def main_test():
102
+ @click.option('--mpl', is_flag=True, default=False, help='Run the test including figure tests.')
103
+ @click.option('--remote-data', is_flag=True, default=False, help='Run the test including figure tests.')
104
+ @click.option('--all', is_flag=True, default=False, help='Run the test including figure tests.')
105
+ def main_test(mpl, remote_data, all):
103
106
  """Test PyThea."""
104
- pytest.main(['-W', 'ignore', '--pyargs', 'PyThea'])
107
+
108
+ test_directory = os.path.dirname(__file__)
109
+
110
+ print(f'Running a test of PyThea package located in: {test_directory}')
111
+
112
+ if mpl:
113
+ # Run a test of the package including figure tests
114
+ pytest.main(['-W', 'ignore', '--mpl', '--mpl-hash-library=figure_hashes.json', '--pyargs', f'{test_directory}'])
115
+ elif remote_data:
116
+ # Run a test of the package including remote-data tests
117
+ pytest.main(['-W', 'ignore', '--remote-data', '--pyargs', f'{test_directory}'])
118
+ elif all:
119
+ # Run a test of the package including remote-data tests
120
+ pytest.main(['-W', 'ignore', '--mpl', '--mpl-hash-library=figure_hashes.json', '--remote-data', '--pyargs', f'{test_directory}'])
121
+ else:
122
+ # Run a minimum test of the package (figure tests are always true and remote-data tests are skipped)
123
+ pytest.main(['-W', 'ignore', '--pyargs', f'{test_directory}'])
105
124
 
106
125
 
107
126
  if __name__ == '__main__':
@@ -8,6 +8,7 @@ import warnings
8
8
  import astropy.units as u
9
9
  import numpy as np
10
10
  import sunpy.map
11
+ from sunpy.map.mapsequence import MapSequence
11
12
 
12
13
  import PyThea.sunpy_dev.extern.sunkit_instruments.aia.utils # noqa
13
14
  import PyThea.sunpy_dev.extern.sunkit_instruments.lasco.utils # noqa
@@ -47,7 +48,7 @@ def maps_sequence_processing(map_sequence, **kwargs):
47
48
 
48
49
  smap = []
49
50
  if seq_type == 'Running Diff.':
50
- for i in range(1+diff_num, len(map_sequence)):
51
+ for i in range(diff_num, len(map_sequence)):
51
52
  smap_diff = difference_maps(map_sequence[i], map_sequence[i-diff_num])
52
53
  smap.append(smap_diff)
53
54
  if seq_type == 'Base Diff.':
@@ -151,7 +152,11 @@ def filter_maps(map_sequence, **kwargs):
151
152
  map_sequence = [tmap for tmap in map_sequence if tmap.meta['polar'] == kwargs['polar']]
152
153
 
153
154
  if len(map_sequence) != 0:
154
- sequence_final = sunpy.map.Map(map_sequence, sequence=True)
155
+ if isinstance(map_sequence, MapSequence):
156
+ return map_sequence
157
+ else:
158
+ sequence_final = sunpy.map.Map(map_sequence, sequence=True)
159
+
155
160
  else:
156
161
  sequence_final = []
157
162
 
@@ -0,0 +1,7 @@
1
+ {
2
+ "PyThea.test.test_figures.test_ellipsoid_on_AIA_venus": "f1ff774b483a8c934c9353c552278c8823216fc7d9dad4ccc00c74be3f30c4c3",
3
+ "PyThea.test.test_figures.test_ellipsoid_on_AIA_mercury": "f6afda1c769a061b7ab1fc64c4e9c0f4658cdb97c3be83828ba5d98bf1bb182c",
4
+ "PyThea.test.test_figures.test_ellipsoid_on_STEREO_COR1_venus": "18a3af72e9da5b60e435f83ee3ef3f8cd0eb437eaef463329552ff56968f12ff",
5
+ "PyThea.test.test_figures.test_ellipsoid_on_STEREO_COR2_three_planets": "231d5635f57c4d66556674a83f6cbcef7dc94b51846e977c4c2dc3dc244096ac",
6
+ "PyThea.test.test_figures.test_kinematics_figure": "83e060de53b57e9d34fe50111ba60a44f7c7c7b20faae9a4381654ef1c9ea72d"
7
+ }