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: SourceMorphology

Class for AGN (accretion disk) source morphology.

Supports two modes:

Static mode (default, is_time_varying=False, no user_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_snapshots provided):

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 static kernel_map property raises AttributeError in this mode (use get_time_dependent_kernel_maps() instead). Pixel scales are taken directly from the user_snapshots dictionary 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_nm corrected for redshift, using the thin-disk SED model in calculate_accretion_disk_emission.

Returns

numpy.ndarray

2-D array of shape (2*r_resolution, 2*r_resolution) normalised so that its sum equals 1.

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: SourceMorphology

Class for Gaussian source morphology.

get_kernel_map()[source]

Returns the 2D array of the Gaussian kernel map. The kernel map is a 2D array that represents the morphology of the source. The kernel map is used to convolve with the microlensing magnification map. The kernel is normalized to 1.

Returns:

2D array of the AGN kernel map.

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: object

Base 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_kernel_map(*args, **kwargs)[source]

Returns the 2D array of the kernel map.

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: SourceMorphology

Class for Supernovae source morphology.

get_kernel_map(time_days)[source]

Builds the SED-weighted kernel map using O(N) 1D radial integration followed by an exact 2D projection.

Module contents