By Simon Zieleniewski Last updated 01-11-15 ''' import os import numpy as n import scipy.interpolate as si from scipy.ndimage.filters import convolve1d from modules.Gaussians import Gauss from modules.misc_utils import path_setup prism_path = path_setup('../../Sim_data/Prism/') def nr(lamb, s, Rpower): '''Crude function to perform N-R solving method on equation: lam - dellam(lam)/2. = s, where s = lam_0 + dellam(lam_0)/2, and dellam(lam) = lam/R. Inputs: lamb - wavelength [um] s - previous step [um] R - Resolving power Outputs:
Last edited 28-04-16 ''' import os import numpy as n import astropy.io.fits as p import scipy.interpolate as s from scipy.optimize import curve_fit from modules.Gaussians import Gauss2D from modules.frebin import * from modules.spaxel_rebin import * from modules.Math_functions import x1, x2, x6 from modules.misc_utils import path_setup from modules.fits_utils import psf_fits_header_check, wavelength_array psf_path = path_setup('../../Sim_data/PSFs/') #AO options = 'SCAO', 'LTAO', 'Gaussian' #If user provides PSF - this always supersedes AO choice #PSF convolution ideally needs to happen at a spatial scale at least 1/10th of the output scale #for the coarsest scales(10,20,40,60 mas) and at least 1/5th of the output scale of the finest #scale (4, 5 mas). #Depending on the input and output cube spatial scales, generate the PSF cube accordingly, #perform the convolution with both input cube and PSF cube at same spatial scale then #frebin up to the output spatial scale. def psf_setup(cube, head, lambs, spax, user_PSF, AO, seeing, tel): '''Function to perform PSF setup Inputs:
Written by Simon Zieleniewski Created: 16-10-15 Last edited 01-12-15 ''' import numpy as n import scipy as s import os from modules.gauss_convolve import gauss_convolve from JSIM_Lowres import low_res_spec from modules.misc_utils import path_setup tppath = path_setup('../../Sim_data/Throughput/') def create_thruput_cube(datacube_shape, wavels, resolution, grating, telescope=True, instrument=True, illumination=None): '''Function that creates cube representing total throughput for each pixel in datacube. This incorporates sky, telescope, instrument and detector throughputs to convert photons to electrons. This will also be able to add in additional effects like illumination patterns. Inputs: datacube_shape: (z, y, x) shape of science datacube wavels: wavelength array of datacube resolution: spectral resolution [um] grating: Grating choice (string) telescope: Boolian incorporate telescope throughput
transmission and background aspects of the model Written by Simon Zieleniewski Started 11-06-13 Last edited 27-10-16 by Laurence Routledge ''' import numpy as n import scipy as s import os from modules.gauss_convolve import gauss_convolve from TheSimulator_Lowres import low_res_spec from modules.misc_utils import path_setup tppath = path_setup('../../Sim_data/Throughput/') def create_thruput_cube(datacube_shape, wavels, resolution, grating, zenith_angle, inst_tpvals, sky=True, telescope=True, instrument=True, QE=True, illumination=None): '''Function that creates cube representing total throughput for each pixel in datacube. This incorporates sky, telescope, instrument and detector throughputs to convert photons to
Written by Simon Zieleniewski Started 14-06-13 Last edited: 23-06-15 ''' import os import numpy as n from scipy.interpolate import interp1d import scipy.constants as sc from modules.gauss_convolve import gauss_convolve from modules.frebin import * from TheSimulator_Lowres import low_res_spec from modules.misc_utils import path_setup bgpath = path_setup('../../Sim_data/Background/') def create_background_cube(datacube_shape, wavels, thru_cube, inst_qe_cube, qe_cube, DIT, NDIT, spaxel, resolution, wave_disp, area, temp, sky=True,
for HARMONI simulation code. By Simon Zieleniewski Last updated 14-04-15 ''' import os import numpy as n import scipy.interpolate as si from scipy.ndimage.filters import convolve1d from modules.Gaussians import Gauss from modules.misc_utils import path_setup r500_path = path_setup('../../Sim_data/R500/') def nr(lamb, s, Rpower): '''Crude function to perform N-R solving method on equation: lam - dellam(lam)/2. = s, where s = lam_0 + dellam(lam_0)/2, and dellam(lam) = lam/R. Inputs: lamb - wavelength [um] s - previous step [um] R - Resolving power Outputs:
Started 16-10-15 Last edited: 01-12-15 ''' import os import numpy as n from scipy.interpolate import interp1d import scipy.constants as sc from modules.gauss_convolve import gauss_convolve from modules.frebin import * from JSIM_Lowres import low_res_spec from modules.misc_utils import path_setup bgpath = path_setup('../../Sim_data/Background/') def create_background_cube(datacube_shape, wavels, thru_cube, inst_qe_cube, DIT, NDIT, spaxel, resolution, wave_disp, area, temp, sky=True, telescope=True, emis=0.15, slow=False): '''Function that creates cube representing total background photons for each pixel in datacube. Inputs: datacube_shape: (z, y, x) shape of science datacube wavels: wavelength array of datacube thru_cube: cube representing total throughput. Used to convert sky signal from photons > electrons tel_qe_cube: cube representing throughput of instrument+detector. Used to convert telescope thermal background from photons > electrons DIT: exposure time [s]
''' import os import numpy as n import astropy.io.fits as p import scipy.interpolate as s from scipy.optimize import curve_fit from modules.Gaussians import Gauss2D from modules.frebin import * from modules.spaxel_rebin import * from modules.Math_functions import x1, x2, x6 from modules.misc_utils import path_setup from modules.fits_utils import psf_fits_header_check, wavelength_array psf_path = path_setup('../../Sim_data/PSFs/') #AO options = 'SCAO', 'LTAO', 'Gaussian' #If user provides PSF - this always supersedes AO choice #PSF convolution ideally needs to happen at a spatial scale at least 1/10th of the output scale #for the coarsest scales(10,20,40,60 mas) and at least 1/5th of the output scale of the finest #scale (4, 5 mas). #Depending on the input and output cube spatial scales, generate the PSF cube accordingly, #perform the convolution with both input cube and PSF cube at same spatial scale then #frebin up to the output spatial scale. def psf_setup(cube, head, lambs, spax, user_PSF, AO, seeing, tel): '''Function to perform PSF setup Inputs:
By Simon Zieleniewski Last updated 14-04-15 ''' import os import numpy as n import scipy.interpolate as si from scipy.ndimage.filters import convolve1d from modules.Gaussians import Gauss from modules.misc_utils import path_setup r500_path = path_setup('../../Sim_data/R500/') def nr(lamb, s, Rpower): '''Crude function to perform N-R solving method on equation: lam - dellam(lam)/2. = s, where s = lam_0 + dellam(lam_0)/2, and dellam(lam) = lam/R. Inputs: lamb - wavelength [um] s - previous step [um] R - Resolving power Outputs:
for NIRSpec simulation code. By Simon Zieleniewski Last updated 01-11-15 ''' import os import numpy as n import scipy.interpolate as si from scipy.ndimage.filters import convolve1d from modules.Gaussians import Gauss from modules.misc_utils import path_setup prism_path = path_setup('../../Sim_data/Prism/') def nr(lamb, s, Rpower): '''Crude function to perform N-R solving method on equation: lam - dellam(lam)/2. = s, where s = lam_0 + dellam(lam_0)/2, and dellam(lam) = lam/R. Inputs: lamb - wavelength [um] s - previous step [um] R - Resolving power Outputs: