Skip to content

Commit eb132f2

Browse files
authored
Merge pull request #30 from cdiazbas/master
[FIX] Improves spectral PSF degradation
2 parents 115f952 + ad45266 commit eb132f2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hazel/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,9 +1364,9 @@ def synthesize(self, perturbation=False):
13641364
if (v.psf_spectral is not None):
13651365
for i in range(4):
13661366
if (perturbation):
1367-
v.stokes_perturbed[i,:] = scipy.signal.convolve(v.stokes_perturbed[i,:], v.psf_spectral, mode='same', method='auto')
1367+
v.stokes_perturbed[i,:] = scipy.ndimage.convolve(v.stokes_perturbed[i,:], v.psf_spectral, mode='nearest')
13681368
else:
1369-
v.stokes[i,:] = scipy.signal.convolve(v.stokes[i,:], v.psf_spectral, mode='same', method='auto')
1369+
v.stokes[i,:] = scipy.ndimage.convolve(v.stokes[i,:], v.psf_spectral, mode='nearest')
13701370

13711371
if (v.interpolate_to_lr):
13721372
for i in range(4):

hazel/spectrum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def __init__(self, wvl=None, weights=None, observed_file=None, name=None, stokes
5858
f = interpolate.interp1d(tmp[:,0] + self.wavelength_axis[n//2-1], tmp[:,1], kind='cubic', fill_value=0.0, bounds_error=False)
5959
self.psf_spectral = f(self.wavelength_axis)
6060
else:
61-
sigma = float(instrumental_profile) * np.mean(self.wavelength_axis) / c.to('km/s').value
62-
self.psf_spectral = np.exp(-(self.wavelength_axis - self.wavelength_axis[n//2-1])**2 / sigma**2)
61+
sigma = float(instrumental_profile) * np.mean(self.wavelength_axis) / c.to('km/s').value
62+
self.psf_spectral = np.exp(-(self.wavelength_axis - self.wavelength_axis[n//2-1])**2 / (2*(sigma**2)))
6363

6464
self.psf_spectral /= np.sum(self.psf_spectral)
6565

0 commit comments

Comments
 (0)