Skip to content

Commit 8010698

Browse files
Fixes for sun-earth distance changing when it shouldn't
This caused our circle cutout to appear to flicker in the movie
1 parent b8a0790 commit 8010698

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

suncet_instrument_simulator/make_radiance_maps.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class MakeRadianceMaps:
1515
def __init__(self, config = None):
1616
if config is None:
17-
config_filename = os.getcwd() + '/config_files/config_default.ini'
17+
config_filename = os.getcwd() + '/suncet_instrument_simulator/config_files/config_default.ini'
1818
self.config = self.__read_config(config_filename)
1919
else:
2020
self.config = config
@@ -165,8 +165,9 @@ def __construct_maps(self):
165165
def __solve_solar_params(self, header = None):
166166
date = header['DATE-OBS']
167167
solar_distance = int(sunpy.coordinates.sun.earth_distance(time = date).to(u.m).value)
168-
solar_radius = sunpy.coordinates.sun.angular_radius(t=date)
169-
return (solar_distance, solar_radius)
168+
solar_radius_angular = sunpy.coordinates.sun.angular_radius(t=date)
169+
solar_radius_meters = solar_distance * np.tan(solar_radius_angular.to(u.rad).value)
170+
return (solar_distance, solar_radius_angular, solar_radius_meters)
170171

171172
def __save_map_sequence(self):
172173
map_file_out = self.__make_outgoing_filename()
@@ -176,11 +177,13 @@ def __save_map_sequence(self):
176177
hdu = fits.PrimaryHDU(map.data, map.fits_header)
177178
hdu.header['DSUN_OBS'] = solar_params[0]
178179
hdu.header['RSUN'] = solar_params[1].value
180+
hdu.header['RSUN_REF'] = solar_params[2]
179181
hdul = fits.HDUList(hdu)
180182
else:
181183
hdu = fits.ImageHDU(map.data, map.fits_header)
182184
hdu.header['DSUN_OBS'] = solar_params[0]
183185
hdu.header['RSUN'] = solar_params[1].value
186+
hdu.header['RSUN_REF'] = solar_params[2]
184187
hdul.append(hdu)
185188
print('Saving Map: ' + map_file_out)
186189
try:

suncet_instrument_simulator/simulator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def __load_radiance_maps(self):
7575

7676
for map in maps:
7777
wavelength = str(map.wavelength)
78+
if 'RSUN_REF' not in map.meta:
79+
map.meta['RSUN_REF'] = 6.96e8 # meters but can't use astropy units here because its a FITS header standard
7880
maps_by_index_and_wavelength[index][wavelength] = map
7981

8082
self.radiance_maps = maps_by_index_and_wavelength

0 commit comments

Comments
 (0)