Loading Catalog/C6_50sqdeg.py +9 −6 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,6 @@ import h5py as h5 import healpy as hp import healpy as hp import astropy.constants as cons import astropy.constants as cons import traceback import traceback import cmath from astropy.coordinates import spherical_to_cartesian from astropy.coordinates import spherical_to_cartesian from astropy.table import Table from astropy.table import Table from scipy import interpolate from scipy import interpolate Loading Loading @@ -222,13 +221,17 @@ class Catalog(CatalogBase): param['e2'] = gals['ellipticity_true'][igals][1] param['e2'] = gals['ellipticity_true'][igals][1] # For shape calculation # For shape calculation param['e1'], param['e2'], param['ell_total'] = self.rotate_ellipticity( param['ell_total'] = np.sqrt(param['e1']**2 + param['e2']**2) e1=gals['ellipticity_true'][igals][0], e2=gals['ellipticity_true'][igals][1], rotation=self.rotation, unit='radians') # param['ell_total'] = np.sqrt(param['e1']**2 + param['e2']**2) if param['ell_total'] > 0.9: if param['ell_total'] > 0.9: continue continue phi_e = cmath.phase(complex(param['e1'], param['e2'])) # phi_e = cmath.phase(complex(param['e1'], param['e2'])) param['e1'] = param['ell_total'] * np.cos(phi_e + 2*self.rotation) # param['e1'] = param['ell_total'] * np.cos(phi_e + 2*self.rotation) param['e2'] = param['ell_total'] * np.sin(phi_e + 2*self.rotation) # param['e2'] = param['ell_total'] * np.sin(phi_e + 2*self.rotation) param['e1_disk'] = param['e1'] param['e1_disk'] = param['e1'] param['e2_disk'] = param['e2'] param['e2_disk'] = param['e2'] Loading ObservationSim/MockObject/CatalogBase.py +11 −0 Original line number Original line Diff line number Diff line import numpy as np import numpy as np import galsim import galsim import copy import copy import cmath from astropy.table import Table from astropy.table import Table from abc import abstractmethod, ABCMeta from abc import abstractmethod, ABCMeta Loading Loading @@ -73,6 +74,16 @@ class CatalogBase(metaclass=ABCMeta): } } return param return param @staticmethod def rotate_ellipticity(e1, e2, rotation=0., unit='radians'): if unit == 'degree': rotation = np.radians(rotation) e_total = np.sqrt(e1**2 + e2**2) phi = cmath.phase(complex(e1, e2)) e1 = e_total * np.cos(phi + 2*rotation) e2 = e_total * np.sin(phi + 2*rotation) return e1, e2, e_total @staticmethod @staticmethod def convert_sed(mag, sed, target_filt, norm_filt=None): def convert_sed(mag, sed, target_filt, norm_filt=None): bandpass = target_filt.bandpass_full bandpass = target_filt.bandpass_full Loading Loading
Catalog/C6_50sqdeg.py +9 −6 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,6 @@ import h5py as h5 import healpy as hp import healpy as hp import astropy.constants as cons import astropy.constants as cons import traceback import traceback import cmath from astropy.coordinates import spherical_to_cartesian from astropy.coordinates import spherical_to_cartesian from astropy.table import Table from astropy.table import Table from scipy import interpolate from scipy import interpolate Loading Loading @@ -222,13 +221,17 @@ class Catalog(CatalogBase): param['e2'] = gals['ellipticity_true'][igals][1] param['e2'] = gals['ellipticity_true'][igals][1] # For shape calculation # For shape calculation param['e1'], param['e2'], param['ell_total'] = self.rotate_ellipticity( param['ell_total'] = np.sqrt(param['e1']**2 + param['e2']**2) e1=gals['ellipticity_true'][igals][0], e2=gals['ellipticity_true'][igals][1], rotation=self.rotation, unit='radians') # param['ell_total'] = np.sqrt(param['e1']**2 + param['e2']**2) if param['ell_total'] > 0.9: if param['ell_total'] > 0.9: continue continue phi_e = cmath.phase(complex(param['e1'], param['e2'])) # phi_e = cmath.phase(complex(param['e1'], param['e2'])) param['e1'] = param['ell_total'] * np.cos(phi_e + 2*self.rotation) # param['e1'] = param['ell_total'] * np.cos(phi_e + 2*self.rotation) param['e2'] = param['ell_total'] * np.sin(phi_e + 2*self.rotation) # param['e2'] = param['ell_total'] * np.sin(phi_e + 2*self.rotation) param['e1_disk'] = param['e1'] param['e1_disk'] = param['e1'] param['e2_disk'] = param['e2'] param['e2_disk'] = param['e2'] Loading
ObservationSim/MockObject/CatalogBase.py +11 −0 Original line number Original line Diff line number Diff line import numpy as np import numpy as np import galsim import galsim import copy import copy import cmath from astropy.table import Table from astropy.table import Table from abc import abstractmethod, ABCMeta from abc import abstractmethod, ABCMeta Loading Loading @@ -73,6 +74,16 @@ class CatalogBase(metaclass=ABCMeta): } } return param return param @staticmethod def rotate_ellipticity(e1, e2, rotation=0., unit='radians'): if unit == 'degree': rotation = np.radians(rotation) e_total = np.sqrt(e1**2 + e2**2) phi = cmath.phase(complex(e1, e2)) e1 = e_total * np.cos(phi + 2*rotation) e2 = e_total * np.sin(phi + 2*rotation) return e1, e2, e_total @staticmethod @staticmethod def convert_sed(mag, sed, target_filt, norm_filt=None): def convert_sed(mag, sed, target_filt, norm_filt=None): bandpass = target_filt.bandpass_full bandpass = target_filt.bandpass_full Loading