def _spec_grid(self): '''Creates a grid used for interpolation. ''' grid = make_grid(3000, 10500, resolution=80000, oversample=2) self.raw_grid = grid
def mapToGrid(spec, xmin, xmax, resolution=50000): ''' This function will interpolate a given input spectrum onto predetermined grid points. ''' grid = make_grid(lambda_start=xmin, lambda_end=xmax, resolution=resolution) spline = CubicSpline(spec.wave, spec.flux) new_spec = (grid, spline(grid)) return new_spec
if __name__ == "__main__": from edibles.utils.functions import make_grid import matplotlib.pyplot as plt # set params alpha = 0.0576265588185308 gamma = 0.00048255778745462673 delta_v = 1000.0 x_min = 5888.0 x_max = 5892.0 R = cst.c.value / delta_v lam = make_grid(x_min, x_max, resolution=R) lam_0 = 5890.0 b = 3 d = 0.00048255778745462673 Nf = 28747080.71319038 tau_0 = 0.05 x = lam - lam_0 one = voigtMath(x, alpha, gamma) plt.plot(x, one) plt.show() two = voigtOpticalDepth(x=lam, lam_0=lam_0, b=b, d=d, Nf=Nf) plt.plot(lam, two) plt.show()