sczesla / PyAstronomy

A collection of astronomy-related routines in Python
154 stars 35 forks source link

Wavelength range in cross correlation #12

Closed novaric closed 8 years ago

novaric commented 8 years ago

Hi,

I have a question about the method crosscorrRV from the latest git version. Currently using "doppler" mode, there is a test to check if the observed spectrum is overall covered by the template in wavelength. But this has to be done in rest-frame, i.e. taking into account the RV shift of the observations with respect to the template.

What I do not understand is that this test is performed by adding the RV shift to the wavelength limits of the observations (see code below, (1+RVMAX/c) ) rather than *removing it, before comparing with the wavelength limits of the template. Currently it raises an error for my data (saying the template does not cover the observations) although in restframe the template spectrum covers well the observations. for example in my case:

Am I thinking something wrong here ? What is the idea of checking the wavelength by RV-shifting the limits of the observations?

Thank you,

Johan

elif mode == "doppler": maxwl = w[-1] * (1.0+rvmax/c) minwl = w[0] * (1.0+rvmin/c) if minwl < tw[0]: raise(PE.PyAValError("The minimum wavelength is not covered by the template.", \ where="crosscorrRV", \ solution=["Provide a larger template", "Try to use skipedge"])) if maxwl > tw[-1]: raise(PE.PyAValError("The maximum wavelength is not covered by the template.", \ where="crosscorrRV", \ solution=["Provide a larger template", "Try to use skipedge"]))

sczesla commented 8 years ago

Hi Johan,

Well, I think this is a bug. The idea was that the template must cover the entire observation for all RVs under consideration. I admit that this does not seem to be exactly what was implemented. I pushed a (hopefully) fixed version. It least the dummy example below works.

So far, I never tried the algorithm for RVs larger than a few km/s, so I am curious to see whether it works for you.

Cheers, Stefan

from PyAstronomy import pyasl
import numpy as np
import matplotlib.pylab as plt

tw = np.arange(220.0, 10000.0)
ts = np.ones(tw.size)

w = np.arange(4750., 9350.)
s = np.ones(w.size)

drv, cc = pyasl.crosscorrRV(w, s, tw, ts,  60000., 120000., 10000.)

plt.plot(drv, cc, 'bp-')
plt.show()
novaric commented 8 years ago

Thanks a lot for your quick response! I will let you know if I have any other question.

Best,

Johan

On 27 Oct 2015, at 18:15, Stefan Czesla notifications@github.com<mailto:notifications@github.com> wrote:

Hi Johan,

Well, I think this is a bug. The idea was that the template must cover the entire observation for all RVs under consideration. I admit that this does not seem to be exactly what was implemented. I pushed a (hopefully) fixed version. It least the dummy example below works.

So far, I never tried the algorithm for RVs larger than a few km/s, so I am curious to see whether it works for you.

Cheers, Stefan

from PyAstronomy import pyasl import numpy as np import matplotlib.pylab as plt

tw = np.arange(220.0, 10000.0) ts = np.ones(tw.size)

w = np.arange(4750., 9350.) s = np.ones(w.size)

drv, cc = pyasl.crosscorrRV(w, s, tw, ts, 60000., 120000., 10000.)

plt.plot(drv, cc, 'bp-') plt.show()

— Reply to this email directly or view it on GitHubhttps://github.com/sczesla/PyAstronomy/issues/12#issuecomment-151574382.