Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56d0e6c

Browse files
JonasSinjanCopilot
andcommitted
change phimap colormaps to more accessible ones, adjusted example to include fdt vlos and wrap lines
Co-authored-by: Copilot <[email protected]>
1 parent ade1e4e commit 56d0e6c

3 files changed

Lines changed: 41 additions & 25 deletions

File tree

examples/plotting/phi_example.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919
# Searching for PHI-HRT Data
2020
# --------------------------
2121
#
22-
# We first search for all **Solar Orbiter PHI-HRT** (High Resolution Telescope) data products # (excluding 'phi-hrt-stokes' which is not compatible with sunpy.map)
22+
# We first search for all **Solar Orbiter PHI-HRT** (High Resolution Telescope)
23+
# data products # (excluding 'phi-hrt-stokes' which is not compatible with sunpy.map)
2324

2425
t_start_hrt = Time('2024-03-23T20:00', format='isot', scale='utc')
2526
t_end_hrt = Time('2024-03-23T23:59', format='isot', scale='utc')
2627

27-
search_results_phi_hrt_all = Fido.search(a.Instrument('PHI'), a.Time(t_start_hrt.value, t_end_hrt.value), (a.soar.Product('phi-hrt-blos') | a.soar.Product('phi-hrt-bmag') | a.soar.Product('phi-hrt-binc') | a.soar.Product('phi-hrt-bazi')| a.soar.Product('phi-hrt-vlos') | a.soar.Product('phi-hrt-icnt')))
28+
search_results_phi_hrt_all = Fido.search(a.Instrument('PHI'), a.Time(t_start_hrt.value, t_end_hrt.value),
29+
(a.soar.Product('phi-hrt-blos') | a.soar.Product('phi-hrt-bmag') |
30+
a.soar.Product('phi-hrt-binc') | a.soar.Product('phi-hrt-bazi')|
31+
a.soar.Product('phi-hrt-vlos') | a.soar.Product('phi-hrt-icnt')))
2832

2933
print(search_results_phi_hrt_all)
3034

@@ -49,6 +53,7 @@
4953

5054
phi_hrt_blos_map.plot()
5155
plt.colorbar(label=phi_hrt_blos_map.unit.to_string())
56+
plt.clim(-1500,1500)
5257

5358
########################################
5459

@@ -83,13 +88,15 @@
8388
# --------------------------
8489
#
8590
# We first search for all **Solar Orbiter PHI-FDT** (Full Disc Telescope) data products
86-
# For this time range, at the time of this example creation 'phi-fdt-vlos' is not available yet via SOAR
8791
# (excluding 'phi-fdt-stokes' which is not compatible with sunpy.map)
8892

8993
t_start_fdt = Time('2025-02-25T20:00', format='isot', scale='utc')
9094
t_end_fdt = Time('2025-02-25T23:59', format='isot', scale='utc')
9195

92-
search_results_phi_fdt_all = Fido.search(a.Instrument('PHI'), a.Time(t_start_fdt.value, t_end_fdt.value), (a.soar.Product('phi-fdt-blos') | a.soar.Product('phi-fdt-bmag') | a.soar.Product('phi-fdt-binc') | a.soar.Product('phi-fdt-bazi')| a.soar.Product('phi-fdt-icnt')))
96+
search_results_phi_fdt_all = Fido.search(a.Instrument('PHI'), a.Time(t_start_fdt.value, t_end_fdt.value),
97+
(a.soar.Product('phi-fdt-blos') | a.soar.Product('phi-fdt-bmag') |
98+
a.soar.Product('phi-fdt-binc') | a.soar.Product('phi-fdt-bazi')|
99+
a.soar.Product('phi-fdt-vlos')| a.soar.Product('phi-fdt-icnt')))
93100

94101
print(search_results_phi_fdt_all)
95102

@@ -106,7 +113,8 @@
106113
phi_fdt_bmag_map = sunpy.map.Map(files_phi_fdt_all[1]).rotate(recenter=True)
107114
phi_fdt_binc_map = sunpy.map.Map(files_phi_fdt_all[2]).rotate(recenter=True)
108115
phi_fdt_bazi_map = sunpy.map.Map(files_phi_fdt_all[3]).rotate(recenter=True)
109-
phi_fdt_icnt_map = sunpy.map.Map(files_phi_fdt_all[4]).rotate(recenter=True)
116+
phi_fdt_vlos_map = sunpy.map.Map(files_phi_fdt_all[4]).rotate(recenter=True)
117+
phi_fdt_icnt_map = sunpy.map.Map(files_phi_fdt_all[5]).rotate(recenter=True)
110118

111119
###############################################################################
112120
# Make a mask to mask out off-disc pixels and make new sunpy maps
@@ -118,12 +126,14 @@
118126
phi_fdt_bmag_map = sunpy.map.Map(phi_fdt_bmag_map.data, phi_fdt_bmag_map.meta, mask=mask)
119127
phi_fdt_binc_map = sunpy.map.Map(phi_fdt_binc_map.data, phi_fdt_binc_map.meta, mask=mask)
120128
phi_fdt_bazi_map = sunpy.map.Map(phi_fdt_bazi_map.data, phi_fdt_bazi_map.meta, mask=mask)
129+
phi_fdt_vlos_map = sunpy.map.Map(phi_fdt_vlos_map.data, phi_fdt_vlos_map.meta, mask=mask)
121130
phi_fdt_icnt_map = sunpy.map.Map(phi_fdt_icnt_map.data, phi_fdt_icnt_map.meta, mask=mask)
122131

123132
########################################
124133

125134
phi_fdt_blos_map.plot()
126135
plt.colorbar(label=phi_fdt_blos_map.unit.to_string())
136+
plt.clim(-1500,1500)
127137

128138
########################################
129139

@@ -143,6 +153,12 @@
143153

144154
########################################
145155

156+
phi_fdt_vlos_map.plot()
157+
plt.colorbar(label=phi_fdt_vlos_map.unit.to_string())
158+
plt.clim(-2,2)
159+
160+
########################################
161+
146162
phi_fdt_icnt_map.plot()
147163
plt.colorbar(label=phi_fdt_icnt_map.unit.to_string())
148164
plt.clim(0,1.2)

sunpy/map/sources/solo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Solar Orbiter Map subclass definitions.
33
"""
44
import numpy as np
5-
from matplotlib.colors import TwoSlopeNorm
5+
from matplotlib.colors import CenteredNorm
66

77
import astropy.units as u
88
from astropy.coordinates import CartesianRepresentation
@@ -121,22 +121,22 @@ def __init__(self, data, header, **kwargs):
121121
btype = self.meta.get('btype','').strip().lower()
122122

123123
if btype == 'los magnetic field strength' or btype == 'blos': # older versions may have blos
124-
self.plot_settings['cmap'] = 'hmimag'
125-
self.plot_settings['norm'] = ImageNormalize(vmin=-1.5e3, vmax=1.5e3, clip=False)
124+
self.plot_settings['cmap'] = 'grey'
125+
self.plot_settings['norm'] = CenteredNorm()
126126
elif btype == 'magnetic field strength' or btype == 'bmag':
127-
self.plot_settings['cmap'] = 'rainbow'
127+
self.plot_settings['cmap'] = 'plasma'
128128
elif btype == 'magnetic field inclination' or btype == 'binc':
129129
self.plot_settings['cmap'] = 'RdGy'
130130
self.plot_settings['norm'] = ImageNormalize(vmin=0, vmax=180, clip=True)
131131
elif btype == 'magnetic field azimuth' or btype == 'bazi':
132-
self.plot_settings['cmap'] = 'hsv'
132+
self.plot_settings['cmap'] = 'twilight'
133133
self.plot_settings['norm'] = ImageNormalize(vmin=0, vmax=180, clip=True)
134134
elif btype == 'los velocity' or btype == 'vlos':
135135
self.plot_settings['cmap'] = 'RdBu_r'
136136
v=np.nanmax(np.abs(self.data))
137-
self.plot_settings['norm'] = TwoSlopeNorm(vcenter=0, vmin=-v, vmax=v)
137+
self.plot_settings['norm'] = CenteredNorm()
138138
elif btype == 'intensity' or btype == 'icnt':
139-
self.plot_settings['cmap'] = 'gist_heat'
139+
self.plot_settings['cmap'] = 'inferno'
140140

141141
if self.detector == 'HRT':
142142
try:

sunpy/map/sources/tests/test_phi_source.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,28 @@
5151

5252
expected_hrt_cmap_list = [
5353
'RdBu_r',
54-
'hmimag',
55-
'rainbow',
54+
'grey',
55+
'plasma',
5656
'RdGy',
57-
'hsv',
58-
'gist_heat',
57+
'twilight',
58+
'inferno',
5959
'RdBu_r',
60-
'hmimag',
61-
'rainbow',
60+
'grey',
61+
'plasma',
6262
'RdGy',
63-
'hsv',
64-
'gist_heat',
63+
'twilight',
64+
'inferno',
6565
]
6666

6767
expected_hrt_norm_list = [
6868
(None,None),
69-
(-1500,1500),
69+
(None,None),
7070
(None,None),
7171
(0,180),
7272
(0,180),
7373
(None,None),
7474
(None,None),
75-
(-1500,1500),
75+
(None,None),
7676
(None,None),
7777
(0,180),
7878
(0,180),
@@ -113,12 +113,12 @@
113113
]
114114

115115
expected_fdt_cmap_list = [
116-
'hmimag',
117-
'gist_heat'
116+
'grey',
117+
'inferno'
118118
]
119119

120120
expected_fdt_norm_list = [
121-
(-1500,1500),
121+
(None, None),
122122
(None, None)
123123
]
124124

0 commit comments

Comments
 (0)