gravelamps.models.singular_isothermal_sphere¶
Singular Isothermal Sphere Lens Implementation
These functions are wrappers around the C++ functions implemented in gravelamps/models/singular-isothermal-sphere.h. These are able to compute the amplification factor in both the wave and geometric optics regimes.
- gravelamps.models.singular_isothermal_sphere.amplification()¶
Computes the amplification factor.
Will compute in the wave optics regime with the specified precision below the specified dimensionless frequency and in the geometric optics regime with standard double precision above it. Adheres to numpy broadcasting rules.
- Parameters:
- dimensionless_frequency: float or ArrayLike
Dimensionless frequencies.
- source_position: float or ArrayLike
Dimensionless displacement from the optical axis.
- geo_switch: int, optional, default=600
Dimensionless frequency above which to use geometric optics.
- summation_limit: int, optional, default=4000
Number of terms to calculate the summation term to.
- precision: int, optional, default=6000
Number of bits of precision to use in the wave optics calculations.
- Returns:
- amp: complex or ArrayLike
Amplification factor values.
- Raises:
- RuntimeError
If arguments cannot be parsed.
- RuntimeWarning
If precision > 50000 wanrs about run time. If summation_limit > precision warns about accuracy.
- gravelamps.models.singular_isothermal_sphere.generate_data()¶
- Constructs interpolator data files for the singular isothermal sphere mass
model.
From the input files, the amplification factor files will be populated with a grid of amplification factor values corresponding to the dimensionless frequency and source position values in their respective files. This function will checkpoint the files and return 85 upon receiving a SIGALRM or SIGINT.
- Parameters:
- dimensionless_frequency_file: str
Path to file containing dimensionless frequency values.
- source_position_file: str
Path to file containing source position values.
- amplification_factor_real_file: str
Path to file containing real component of amplification factor values.
- amplification_factor_imag_file: str
Path to file containing imaginary component of amplification factor values.
- geo_switch: int, optional, default=600
Dimensionless frequency above which to use geometric optics.
- summation_limit: int, optional, default=4000
Number of terms to calculate the summation term to.
- precision: int, optional, default=6000
Number of bits of precision used for wave optics calculation.
- Returns:
- int
0 if completed successfully, 85 if received checkpoint instruction.
- Raises:
- RuntimeError
If arguments cannot be understood.
- RuntimeWarning
If precision > 50000 warns about run time. If summation_limit > precision warns about accuracy.
- gravelamps.models.singular_isothermal_sphere.geometric_amplification()¶
Computes the amplification factor in the geometric optics regime.
Adheres to numpy broadcasting rules.
- Parameters:
- dimensionless_frequency: float or ArrayLike
Dimensionless frequency.
- source_position: float or ArrayLike
Dimensionless displacement from the optical axis.
- Returns:
- amp: complex or ArrayLike
Amplification factor values.
- gravelamps.models.singular_isothermal_sphere.geometric_contribution()¶
Computes the contribution to the amplification factor in the geometric optics regime for the specified image. Image flag specifies the first or second of the two signals. Adheres to numpy broadcasting rules.
- Parameters:
- dimensionless_frequnecy: float or ArrayLike
Dimensionless frequencies.
- source_position: float or ArrayLike
Dimensionless displacement from the optical axis.
- image: int
0 if first image. 1 if second.
- Returns:
- contrib: complex or ArrayLike
Contribution to amplification factor from specified image.
- Raises:
- RuntimeError
If arguments cannot be parsed.
- ValueError
Raised if image is not one of 0 or 1.
- gravelamps.models.singular_isothermal_sphere.magnification()¶
Computes the magnification in the geometric optics regime. Image specifies whether to compute for first or second image.
- Parameters:
- source_position: float or ArrayLike
Dimensionless displacement from the optical axis.
- image: int
0 for the first image, 1 for the second.
- Returns:
- float or ArrayLike
- Raises:
- RuntimeError
If arguments cannot be parsed.
- ValueError
If image is not 0 or 1.
- gravelamps.models.singular_isothermal_sphere.time_delay()¶
Computes the dimensionless time delay between the two signals in the geometric optics approximation.
- Parameters:
- source_position: float or ArrayLike
Dimensionless displacement from the optical axis. Will be flattened if above 1D.
- Returns:
- float or ArrayLike
- gravelamps.models.singular_isothermal_sphere.wave_amplification()¶
Computes the amplification factor in the wave optics regime.
Computation is done with the specified precision and approximating the infinte sum through the calculation of the specified number of terms. Adheres to numpy broadcasting rules
- Parameters:
- dimensionless_frequency: float or ArrayLike
Dimensionless frequencies.
- source_position: float or ArrayLike
Dimensionless displacement from the optical axis.
- summation_limit: int, optional, default=4000
Number of terms to calculate the summation term to.
- precision: int, optional, default=6000
Number of bits of precision for arbitrary precision calculations.
- Returns:
- amp: complex or ArrayLike
Amplification factor values.
- Raises:
- RuntimeError
If arguments cannot be parsed.
- RuntimeWarning
If precision > 50000 wanrs about run time. If summation_limit > precision warns about accuracy.