Closed nagarajanneel closed 1 year ago
Thanks @nagarajanneel !
Can you provide a 1 or 2 line code snippet of just the code surrounding the problem so I can see how you are using the function?
And if you can, tell me what version of muler
you are using?
data_1 = HPFSpectrum(file=r"C:\Users\neeln\Documents\research\exoplanets\rawdata\V1298_Tau_c\Goldilocks_20211009T070707_v1.0_0017.spectra.fits")
data_40 = HPFSpectrum(file= r"C:\Users\neeln\Documents\research\exoplanets\rawdata\V1298_Tau_c\Goldilocks_20211112T043635_v1.0_0014.spectra.fits")
rv_target_a = 14.427u.km/u.s rv_target_b = 1.427u.km/u.s reader_1 = data_1.sky_subtract(method='vector').remove_nans().deblaze().normalize().rv_shift(-rv_target_a) reader_40 = data_40.sky_subtract(method='vector').remove_nans().deblaze().normalize().rv_shift(-rv_target_b)
wl_1 = reader_1.wavelength.value fl_1 = reader_1.flux fl_40 = reader_40.flux
plt.plot(wl_1, fl_1, 'r-', linewidth = 0.2, label='OUT') plt.plot(wl_1, fl_40, 'y-', linewidth = 0.2)
plt.xlim([10827, 10837]) plt.show()
And below is the plot of the two observations that the jupyter notebook returns:
So this plot I get is always the exact same regardless of what I input for rv_target_a and rv_target_b.
Thanks!
(P.S. How can I check the version of muler that I have?)
Hi @nagarajanneel thanks again for opening your issue, and sharing a code snippet! 🙏
The snippet revealed the friction point to be in your plotting code. Notice that you are using the same $x-$coordinates for both spectra:
$(x_A, y_A)$ and $(x_A, y_B)$.
You should update the $x-$ coordinates to match the flux:
$(x_A, y_A)$ and $(x_B, y_B)$
# Current plotting snippet has the same wl_1 (erroneous)
plt.plot(wl_1, fl_1, 'r-', linewidth = 0.2, label='OUT')
plt.plot(wl_1, fl_40, 'y-', linewidth = 0.2)
So you may wish to define a new identifier:
wl_40 = reader_40.wavelength.value
And then your new plotting portion would become:
# Updated plotting snippet has different x-coordinates (correct)
plt.plot(wl_1, fl_1, 'r-', linewidth = 0.2, label='OUT')
plt.plot(wl_40, fl_40, 'y-', linewidth = 0.2)
So the .rv_shift()
portion of the code is working as expected. Thank you again for sharing your Issue, do you believe it points to a gap in our documentation? Would it be helpful to include a standalone tutorial on RV-shifting? I have made a prototype tutorial stub here:
Obtaining the muler version is a little subtle depending on how you installed the code, so we will update the code to make this easier in the future. Thank you for guiding us to find this gap.
It appears that we resolved this Issue! :partying_face: Closing...
The rv_shift() function doesn't seem to be working. I found that out by plugging different values for the radial velocity into rv_shift() and saw that they made no difference at all when plotting the relevant observation.
Note that it has worked for me in the past, with older data/observations but is not working for the observations I am analyzing at present (those being the HET observations for K2-136, K2-77, K2-100 and V1298 Tau).
Thanks!