def z_angular_mpc(zmean): '''returns the minimum angular cut to be applied in order to discard nonlinearities ''' cosmo = LambdaCDM(H0=67, Om0=0.319, Ode0=0.681, Ob0=0.049) angle = cosmo.arcsec_per_kpc_comoving(zmean).value * 12000. / 60 return angle
'fits_filename' : 'hlsp_candels_hst_wfc3_gs-tot_f160w_v1.0_drz' } } } for field in list(FIELDS.keys()): for filter in FIELDS[field]: FIELDS[field][filter]['data'] = fits.getdata(f'/home/ppxlf2/CANDELS/{field}/{FIELDS[field][filter]["fits_filename"]}.fits', memmap=True) with open('resources/wcs_memory.pickle', 'rb') as handle: WCS_MEMORY = pickle.load(handle) _h = 0.6774 SKIRT_Z0 = 0.002265 SKIRT_OUTSIZE = 190 FOV = 60 COSMO = LambdaCDM(H0=100*_h, Om0=0.3089, Ob0=0.0486, Ode0=0.6911, Tcmb0=2.73) ps = FOV * u.kpc * COSMO.arcsec_per_kpc_comoving(SKIRT_Z0)/SKIRT_OUTSIZE """ UNITS """ SIM_UNITS = u.W / u.m**2 / u.arcsecond**2 * ps**2 # units of the datacube produced by SKIRT OUT_UNITS = u.Jy * u.Hz / u.micron SNAP_MAP = np.load('resources/snapTNG.npy') REFERENCE_Z = 0.5
from astropy.convolution import convolve from astropy import constants as const from scipy import ndimage as ndi from scipy.stats import median_abs_deviation from pyphot import Sun, unit lib = pyphot.get_library() import sys import glob skirt_z0 = 0.002265 cosmo = LambdaCDM(H0=100 * h, Om0=0.3089, Ob0=0.0486, Ode0=0.6911, Tcmb0=2.73) ps = 60 * u.kpc * cosmo.arcsec_per_kpc_comoving(0.002265) / 319 / u.pix def to_Jansky(l, cube): return (cube.T * (ps.value**2 * u.W / u.m**2 / (const.c / (l * u.micron).to(u.m))).to(u.Jy)).T def to_ergs(l, cube): return (cube.T * (ps.value**2 * u.W / u.m**2 / (u.AA)).to(u.erg / u.cm**2 / u.AA / u.s)).T def to_eps(band, header): band = band.to(u.erg / u.cm**2 / u.AA / u.s, equivalencies=u.spectral_density(u.AA, header['PHOTPLAM']))