slsim.Microlensing.source_morphology package¶
Submodules¶
slsim.Microlensing.source_morphology.agn module¶
- class slsim.Microlensing.source_morphology.agn.AGNSourceMorphology(source_redshift, cosmo, r_out=1000, r_resolution=1000, black_hole_mass_exponent=8.0, inclination_angle=0, black_hole_spin=0, observer_frame_wavelength_in_nm=600, eddington_ratio=0.15, observing_wavelength_band: str = None, is_time_varying=False, user_snapshots=None, *args, **kwargs)[source]¶
Bases:
SourceMorphologyClass for AGN (accretion disk) source morphology.
Supports two modes:
- Static mode (default,
is_time_varying=False, nouser_snapshots): A single emission map is computed once at the observer-frame wavelength and cached as
kernel_map. Pixel scales are derived analytically from the accretion-disk size parameters, so no 2-D array needs to exist before the scales are known.- Time-varying mode via external snapshots (
user_snapshotsprovided): The caller supplies a pre-computed sequence of kernel maps together with their physical pixel scales. The base-class vectorised interpolator handles temporal queries through
get_time_dependent_kernel_maps(). The statickernel_mapproperty raisesAttributeErrorin this mode (useget_time_dependent_kernel_maps()instead). Pixel scales are taken directly from theuser_snapshotsdictionary rather than being derived analytically, because the physical size of the source may evolve over time.
Note¶
Analytical time-varying AGN generation (without external grids) is not yet implemented and will raise
NotImplementedError.- get_kernel_map()[source]¶
Compute and return the normalised 2-D AGN emission-map kernel.
The map is calculated at the (rest-frame) wavelength corresponding to
observer_frame_wavelength_in_nmcorrected for redshift, using the thin-disk SED model incalculate_accretion_disk_emission.Returns¶
- numpy.ndarray
2-D array of shape
(2*r_resolution, 2*r_resolution)normalised so that its sum equals 1.
- Static mode (default,
slsim.Microlensing.source_morphology.gaussian module¶
- class slsim.Microlensing.source_morphology.gaussian.GaussianSourceMorphology(source_redshift, cosmo, source_size, length_x, length_y, num_pix_x, num_pix_y, center_x=0, center_y=0, *args, **kwargs)[source]¶
Bases:
SourceMorphologyClass for Gaussian source morphology.
slsim.Microlensing.source_morphology.source_morphology module¶
- class slsim.Microlensing.source_morphology.source_morphology.SourceMorphology(is_time_varying=False, user_snapshots=None, *args, **kwargs)[source]¶
Bases:
objectBase class for source morphologies.
Handles static and time-varying sources, including vectorized interpolation for dynamic arrays.
- arcsecs_to_metres(arcsecs, cosmo, redshift)[source]¶
Converts arcseconds to meters in the source plane, given the cosmology and redshift.
- Parameters:
arcsecs – Arcseconds to be converted.
cosmo – Astropy cosmology object for angle calculations.
redshift – Redshift of the source.
- Returns:
Transverse distance in meters in the source plane at the given redshift.
- get_time_dependent_kernel_maps(time_anchors)[source]¶
Returns a list of kernel maps and pixel scales for the requested times.
If user_snapshots were provided during initialization, it uses the fast vectorized interpolator. Otherwise, it replicates the static kernel.
- property kernel_map¶
Returns the 2D array of the static kernel map.
- property length_x¶
Returns the length of the 2D kernel map in x direction in arcseconds.
- property length_y¶
Returns the length of the 2D kernel map in y direction in arcseconds.
- metres_to_arcsecs(metres, cosmo, redshift)[source]¶
Converts meters to arcseconds in the source plane, given the cosmology and redshift.
- Parameters:
metres – Meters to be converted.
cosmo – Astropy cosmology object for angle calculations.
redshift – Redshift of the source.
- Returns:
Arcseconds in the source plane at the given redshift.
- property num_pix_x¶
Returns the number of pixels in x direction.
- property num_pix_y¶
Returns the number of pixels in y direction.
- property pixel_scale¶
Returns the geometric mean pixel scale in arcseconds.
- property pixel_scale_m¶
Returns the geometric mean pixel scale in meters.
- property pixel_scale_x¶
Returns the pixel scale in x direction in arcseconds.
- property pixel_scale_x_m¶
Returns the pixel scale in x direction in meters.
- property pixel_scale_y¶
Returns the pixel scale in y direction in arcseconds.
- property pixel_scale_y_m¶
Returns the pixel scale in y direction in meters.
slsim.Microlensing.source_morphology.supernovae module¶
- class slsim.Microlensing.source_morphology.supernovae.SupernovaeSourceMorphology(observing_wavelength_band, source_redshift, cosmo, sn_model_instance=None, sn_modeldir=None, sn_model_name='hsiao', ellipticity=1.0, grid_pixels=300, v_base_km_s=10000.0, v_uv_km_s=18000.0, u_limb_uv=0.8, u_limb_ir=0.2, anchor_spacing_days=5.0, user_snapshots=None, *args, **kwargs)[source]¶
Bases:
SourceMorphologyClass for Supernovae source morphology.