TCDSolar / stixpy

STIX data analysis in python
https://stixpy.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
17 stars 20 forks source link

`calibrate_visibility` should use (0, 0) in HPC rather than in STIX coord so that phase center is center of Sun #139

Open hayesla opened 2 weeks ago

hayesla commented 2 weeks ago

When calibrating visibilities with stixpy.calibrate.visibility.calibrate_visibility, the default flare_location coordinate should be the center of the Sun rather than 0, 0 in STIX coordinate frame, which is important for times when Solar Orbiter is offpointing.

For example,

with using the current default (where flare_location is default to STIXImaging(0 * u.arcsec, 0 * u.arcsec) see here.

cal_vis = calibrate_visibility(vis)

old_pointing

however, when usign this:

>>> center_map = SkyCoord(0*u.arcsec, 0*u.arcsec, frame=Helioprojective(observer=solo, obstime=solo.obstime))
>>> cal_vis = calibrate_visibility(vis, flare_location=center_map.transform_to(STIXImaging))

fixed_pointing

So I guess this should be the default to center the map on the Sun. Thoughts @samaloney

To reproduce

cpd_file = './pixel_data/solo_L1_stix-sci-xray-cpd_20210914T063019-20210914T065025_V02_2109140589-60826.fits'
time_range = ['2021-09-14T06:39:17', '2021-09-14T06:39:57']
energy_range = [4, 16]*u.keV

cpd_sci = Product(cpd_file)

meta_pixels_sci = create_meta_pixels(cpd_sci, 
                                     time_range=time_range, 
                                     energy_range=energy_range, 
                                     flare_location=[0, 0] * u.arcsec, 
                                     no_shadowing=True)

vis_tr = TimeRange(time_range)
roll, solo_xyz, pointing = get_hpc_info(vis_tr.start, vis_tr.end)
solo = HeliographicStonyhurst(*solo_xyz, obstime=vis_tr.center, representation_type="cartesian")

center_map = SkyCoord(0*u.arcsec, 0*u.arcsec, frame=Helioprojective(observer=solo, obstime=solo.obstime))

vis = create_visibility(meta_pixels_sci )
if old:
    cal_vis = calibrate_visibility(vis)
else:
    cal_vis = calibrate_visibility(vis, flare_location=center_map.transform_to(STIXImaging))
# order by sub-collimator e.g. 10a, 10b, 10c, 9a, 9b, 9c ....
isc_10_7 = [3, 20, 22, 16, 14, 32, 21, 26, 4, 24, 8, 28]
idx = np.argwhere(np.isin(cal_vis.meta["isc"], isc_10_7)).ravel()

vis10_7 = cal_vis[idx]
imsize = [512, 512] * u.pixel  # number of pixels of the map to reconstruct
pixel = [10, 10] * u.arcsec / u.pixel  # pixel size in arcsec

bp_image = vis_to_image(vis10_7, imsize, pixel_size=pixel)
hayesla commented 2 weeks ago

also just to note that the IDL version matches the fixed flare_location Screenshot 2024-08-27 at 11 00 41