Commit f5da7652 authored by EPINAT Benoit's avatar EPINAT Benoit

update writing disperison output

parent 2c49b0d7
......@@ -67,27 +67,31 @@ class Image:
"""
Performs an interpolation of the image at higher resolution and stock the new image
"""
x = np.arange(self.length) + 0.5
y = np.arange(self.height) + 0.5
new_x = (np.arange(self.length * self.oversample) + 0.5) / self.oversample
new_y = (np.arange(self.height * self.oversample) + 0.5) / self.oversample
#x = np.arange(self.length) # + 0.5*self.oversample
#y = np.arange(self.height) # + 0.5*self.oversample
#new_x = np.linspace(0, self.length, self.length * int(self.oversample))
#new_y = np.linspace(0, self.height, self.height * int(self.oversample))
x = np.linspace(0, self.length, self.length) # + 0.5*self.oversample
y = np.linspace(0, self.height, self.height) # + 0.5*self.oversample
new_x = np.linspace(0, self.length, self.length * int(self.oversample))
new_y = np.linspace(0, self.height, self.height * int(self.oversample))
data = np.reshape(self.data, -1)
func = interp2d(x, y, data, kind='linear', fill_value=0)
self.data = np.array(func(new_x, new_y)).transpose()
#x = np.linspace(0, self.length, self.length) # + 0.5*self.oversample
#y = np.linspace(0, self.height, self.height) # + 0.5*self.oversample
#new_x = np.linspace(0, self.length, self.length * int(self.oversample))
#new_y = np.linspace(0, self.height, self.height * int(self.oversample))
func = interp2d(x, y, self.data, kind='linear', fill_value=0)
self.data = np.array(func(new_x, new_y))
self.height *= self.oversample
self.length *= self.oversample
self.size *= self.oversample
def conv_inter_flux(self, psf):
"""
Does a convolution of the interpolated image with a psf and stock the result
Does a convolution of the interpolated image with a psf and stocks the result
:param PSF psf: psf object
"""
......
......@@ -3,7 +3,7 @@ import numpy as np
from numpy.fft import fftshift, rfft2, irfft2
#from numpy.fft import fftshift, fft2, ifft2
from Class.Images import Image
import matplotlib.pyplot as plt
#import matplotlib.pyplot as plt
class PSF:
......
......@@ -155,8 +155,8 @@ def generate_input(fileparam, pathout, filemeth='', verbose=False, method='mpfit
outstream = open(pathout + fileout, 'w')
yaml.dump(dictowrite, outstream, default_flow_style=False)
outstream.close()
return
return
def test_config(config):
......
......@@ -228,7 +228,15 @@ def mocking(path=None, filename=None, rank=0):
if files['disp'] is not None:
# XXX VERIFIER, pas sûr que ça fasse ce qu'il faudrait
tools.write_fits(*results['params'], resparams['sig'], model, disp.data - model.vel_disp, out_path+'/resd'+whd, mask=vel.mask)
#tools.write_fits(*results['params'], resparams['sig'], model, disp.data - model.vel_disp, out_path+'/resd'+whd, mask=vel.mask)
#tools.write_fits(np.sqrt(disp.data ** 2 - model.vel_disp ** 2), out_path+'/resd'+whd, config, model, results, mask=vel.mask)
cok = disp.data >= model.vel_disp
#cnook = disp.data < model.vel_disp
#dispres = disp.data
dispres = disp.data * 0
dispres[cok] = np.sqrt(disp.data[cok] ** 2 - model.vel_disp[cok] ** 2)
#dispres[cnook] = 0
tools.write_fits(dispres, out_path+'/resd'+whd, config, model, results, mask=vel.mask)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment