Skip to content

Commit 74dab0b

Browse files
authored
Merge branch 'main' into main
2 parents 86f7c1b + 4c4cef0 commit 74dab0b

14 files changed

Lines changed: 195 additions & 145 deletions

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ci:
1212
repos:
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
1414
# Ruff version.
15-
rev: v0.15.4
15+
rev: v0.15.8
1616
hooks:
1717
- id: ruff
1818
exclude: docs/.*
@@ -23,7 +23,7 @@ repos:
2323
- id: nbqa-ruff
2424
args: ["--line-length=120"]
2525
- repo: https://github.com/psf/black-pre-commit-mirror
26-
rev: 26.1.0
26+
rev: 26.3.1
2727
hooks:
2828
- id: black
2929
# It is recommended to specify the latest version of Python
@@ -32,7 +32,7 @@ repos:
3232
# https://pre-commit.com/#top_level-default_language_version
3333
language_version: python3
3434
- repo: https://github.com/psf/black-pre-commit-mirror
35-
rev: 26.1.0
35+
rev: 26.3.1
3636
hooks:
3737
- id: black-jupyter
3838
language_version: python3

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ How to contribute to the repository?
2626
Check out our step-by-step instructions how you can contribute code to this project Contributing_ Guidelines.
2727
Are you new to coding and contributing to a software development project? No worries! We help you out! Write us on the LSST Slack channel #sl-pipeline.
2828

29-
Note: `sim-pipeline` is written in object-oriented python. What fun!
29+
Note: `SLSim` is written in object-oriented python. What fun!
3030

3131
How can I participate in LSST strong lensing projects?
3232
------------------------------------------------------

docs/slsim.Halos.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ slsim.Halos package
22
===================
33

44
Submodules
5+
----------
56

67
slsim.Halos.halo\_population module
78
-----------------------------------

docs/slsim.Sources.SourceCatalogues.SupernovaeCatalog.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ slsim.Sources.SourceCatalogues.SupernovaeCatalog package
44
Submodules
55
----------
66

7-
slsim.Sources.SourceCatalogues.supernovae\_sample module
8-
--------------------------------------------------------
7+
slsim.Sources.SourceCatalogues.SupernovaeCatalog.supernovae\_sample module
8+
--------------------------------------------------------------------------
99

1010
.. automodule:: slsim.Sources.SourceCatalogues.SupernovaeCatalog.supernovae_sample
1111
:members:

docs/slsim.Sources.SourcePopulation.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ slsim.Sources.SourcePopulation.point\_sources module
2828
:undoc-members:
2929
:show-inheritance:
3030

31+
slsim.Sources.SourcePopulation.scotch\_sources module
32+
-----------------------------------------------------
33+
34+
.. automodule:: slsim.Sources.SourcePopulation.scotch_sources
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
3139
slsim.Sources.SourcePopulation.source\_pop\_base module
3240
-------------------------------------------------------
3341

docs/slsim.Sources.SourceVariability.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ slsim.Sources.SourceVariability.agn module
2020
:undoc-members:
2121
:show-inheritance:
2222

23-
slsim.Sources.SourceVariability.light_curve_interpolation module
24-
----------------------------------------------------------------
23+
slsim.Sources.SourceVariability.light\_curve\_interpolation module
24+
------------------------------------------------------------------
2525

2626
.. automodule:: slsim.Sources.SourceVariability.light_curve_interpolation
2727
:members:
2828
:undoc-members:
2929
:show-inheritance:
3030

31-
slsim.Sources.SourceVariability.sinusoidal_variability module
32-
-------------------------------------------------------------
31+
slsim.Sources.SourceVariability.sinusoidal\_variability module
32+
--------------------------------------------------------------
3333

3434
.. automodule:: slsim.Sources.SourceVariability.sinusoidal_variability
3535
:members:

notebooks/roman_configuration.ipynb

Lines changed: 34 additions & 38 deletions
Large diffs are not rendered by default.

slsim/ImageSimulation/image_simulation.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ def simulate_image(
8282
kwargs_microlensing = {"kwargs_magnification_map":
8383
kwargs_magnification_map, "point_source_morphology":
8484
'gaussian' or 'agn' or 'supernovae',
85-
"kwargs_source_morphology": kwargs_source_morphology} The
86-
kwargs_source_morphology is required for the source
85+
"kwargs_source_morphology": kwargs_source_morphology}.
86+
The kwargs_source_morphology is required for the source
8787
morphology calculation. The kwargs_magnification_map is
8888
required for the microlensing calculation. See the classes
8989
in slsim.Microlensing for more details on the
90-
kwargs_magnification_map and kwargs_source_morphology. If None, defaults are used corresponding to the source in the lens class.
90+
kwargs_magnification_map and kwargs_source_morphology.
91+
If None, defaults are used corresponding to the source in the lens class.
9192
:type kwargs_microlensing: dict or None
9293
:param kwargs: additional keyword arguments for the bands
9394
:type kwargs: dict
@@ -763,14 +764,14 @@ def lens_image_series(
763764
:param gain: Amplifier gain (default 0.7 for LSST).
764765
:param single_visit_mag_zero_points: Zero points of the single-visit image in
765766
different bands. It is a dictionary of the form: {
766-
'g': 32.33,
767-
'r': 32.17,
768-
'i': 31.85,
769-
'z': 31.45,
770-
'y': 30.63
771-
}. It sould contain at least values for the band in which one need to
772-
simulate images. Default values are average magnitude zero points for
773-
LSST single visists in each band.
767+
'g': 32.33,
768+
'r': 32.17,
769+
'i': 31.85,
770+
'z': 31.45,
771+
'y': 30.63
772+
}. It sould contain at least values for the band in which one need to
773+
simulate images. Default values are average magnitude zero points for
774+
LSST single visists in each band.
774775
:param microlensing: boolean flag to include microlensing variability
775776
:return: list of series of images of a lens
776777
"""

slsim/ImageSimulation/roman_image_simulation.py

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,53 +56,53 @@ def simulate_roman_image(
5656
5757
:param lens_class: class object containing all information of the lensing system
5858
(e.g., Lens())
59-
:param band: imaging band
60-
:type band: string
61-
:param num_pix: number of pixels per axis
62-
:type num_pix: integer
59+
:param band: imaging band.
60+
:type band: str
61+
:param num_pix: number of pixels per axis.
62+
:type num_pix: int
6363
:param add_noise: determines whether sky background and detector effects are added or not.
6464
See https://galsim-developers.github.io/GalSim/_build/html/roman.html#galsim.roman.allDetectorEffects
6565
for specific details about the detector effects.
6666
:type add_noise: bool
67-
:param subtract_mean_background: whether to subtract the mean count of photons on the background (not the noise)
67+
:param subtract_mean_background: whether to subtract the mean count of photons on the background (not the noise).
6868
:type subtract_mean_background: bool
69-
:param with_source: determines whether source is included in image
69+
:param with_source: determines whether source is included in image.
7070
:type with_source: bool
71-
:param with_deflector: determines whether deflector is included in image
71+
:param with_deflector: determines whether deflector is included in image.
7272
:type with_deflector: bool
7373
:param exposure_time: exposure time of image. If None, a default exposure time will be retrieved from
7474
lenstronomy's SimulationAPI.ObservationConfig based on the Roman survey mode.
75-
:type exposure_time: int or None
75+
:type exposure_time: int, optional
7676
:param num_exposures: number of exposures. If None, a default number will be retrieved from
7777
lenstronomy's SimulationAPI.ObservationConfig based on the Roman survey mode.
78-
:type num_exposures: int or None
78+
:type num_exposures: int, optional
7979
:param t_obs: an observation time in units of days. This is applicable only for
8080
variable source. In case of point source, if we do not provide
8181
t_obs, considers no variability in the lens.
82-
:param survey_mode: survey mode of the Roman detector
83-
:type survey_mode: string, can be "wide_area" or "time_domain"
84-
:param detector: The specific WFI detector being used to generate the psf. If None, one will be selected at random
85-
:type detector: integer from 1 to 18 or None
86-
:param detector_pos: The pixel on the detector being used to generate the psf. If None, a coordinate will be selected at random.
87-
:type detector_pos: 2-tuple of integers between 4 + num_pix * oversample and 4092 - num_pix * oversample or None
88-
:param seed: An rng seed used for generating detector effects in galsim
89-
:type seed: integer or None
82+
:param survey_mode: survey mode of the Roman detector. Can be "wide_area" or "time_domain".
83+
:type survey_mode: str
84+
:param detector: The specific WFI detector being used to generate the psf (from 1 to 18).
85+
If None, one will be selected at random.
86+
:type detector: int, optional
87+
:param detector_pos: The pixel on the detector being used to generate the psf.
88+
Must be a 2-tuple of integers between 4 + num_pix * oversample and 4092 - num_pix * oversample.
89+
:type detector_pos: tuple, optional
90+
:param seed: An rng seed used for generating detector effects in galsim.
91+
:type seed: int, optional
9092
:param ra: Coordinate in space used to generate sky background. For possible coordinates, see
9193
https://roman-docs.stsci.edu/files/215024143/215024145/2/1768495040130/outlines.png
92-
:type ra: float or None
94+
:type ra: float, optional
9395
:param dec: Coordinate in space used to generate sky background. For possible coordinates, see
9496
https://roman-docs.stsci.edu/files/215024143/215024145/2/1768495040130/outlines.png
95-
:type dec: float or None
97+
:type dec: float, optional
9698
:param date: Date used to generate sky background. The date must be consistent with the ra and dec coordinates.
97-
:type date: datetime.datetime class
99+
:type date: datetime.datetime
98100
:param psf_directory: Path to directory containing psf file(s) where the psf can be loaded.
99101
Otherwise, the psf will be generated by stpsf on the fly, which is very slow.
100-
The name of the psf file inside the directory follows the following convention:
101-
psf_file_name = f"{band}_{detector}_{detector_pos[0]}_{detector_pos[1]}_{oversample}.pkl"
102-
For example, psf_file_name = "F106_SCA03_1934_1293_5.pkl"
103-
:type psf_directory: string
104-
:return: simulated image in units of flux per second
105-
:rtype: 2d numpy array
102+
See the note in the ``get_psf`` method's docstring for details on the PSF file naming convention.
103+
:type psf_directory: str
104+
:return: simulated image in units of flux per second.
105+
:rtype: numpy.ndarray
106106
"""
107107

108108
if detector is None:
@@ -239,22 +239,31 @@ def get_psf(band, detector, detector_pos, oversample, psf_directory):
239239
"""Obtain galsim psf corresponding to specific WFI detector, position,
240240
band, and supersampling factor, using stpsf.
241241
242-
:param band: The specific band corresponding to the psf
243-
:type band: string
244-
:param detector: The specific Roman detector being used to generate the psf
245-
:type detector: integer from 1 to 18
246-
:param detector_pos: The position of the detector being used to generate the psf
247-
:type detector_pos: integer between 4 + num_pix * oversample and 4092 - num_pix * oversample
248-
:param oversample: Number of times that each pixel's side is subdivided for higher accuracy psf convolution
249-
:type oversample: integer
242+
:param band: The specific band corresponding to the psf.
243+
:type band: str
244+
:param detector: The specific Roman detector being used to generate the psf (from 1 to 18).
245+
:type detector: int
246+
:param detector_pos: The position of the detector being used to generate the psf.
247+
Must be between 4 + num_pix * oversample and 4092 - num_pix * oversample.
248+
:type detector_pos: int
249+
:param oversample: Number of times that each pixel's side is subdivided for higher
250+
accuracy psf convolution.
251+
:type oversample: int
250252
:param psf_directory: Path to directory containing psf file(s) where the psf can be loaded.
251253
Otherwise, the psf will be generated by stpsf on the fly, which is very slow.
252-
The name of the psf file inside the directory follows the following convention:
254+
:type psf_directory: str
255+
:return: An image of the psf generated by stpsf.
256+
:rtype: galsim.InterpolatedImage
257+
258+
**Notes on psf naming convention:**
259+
260+
The name of the psf file inside the directory follows this convention::
261+
253262
psf_file_name = f"{band}_{detector}_{detector_pos[0]}_{detector_pos[1]}_{oversample}.pkl"
254-
For example, psf_file_name = "F106_SCA03_1934_1293_5.pkl"
255-
:type psf_directory: string
256-
:return: An image of the psf generated by stpsf
257-
:rtype: galsim's InterpolatedImage class
263+
264+
For example::
265+
266+
psf_file_name = "F106_SCA03_1934_1293_5.pkl"
258267
"""
259268
detector = f"SCA{str(detector).zfill(2)}"
260269
# Since generating the stpsf is very slow, it can alternatively be loaded from a pickle file

slsim/Lenses/lens_pop.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ def select_lens_at_random(self, test_area=None, verbose=False, **kwargs_lens_cut
6565
:type test_area: float or None
6666
:param kwargs_lens_cut: Dictionary of cuts that one wants to apply to the lens.
6767
Example: kwargs_lens_cut = {
68-
"min_image_separation": 0.5,
69-
"max_image_separation": 10,
70-
"mag_arc_limit": {"i", 24},
71-
"second_brightest_image_cut": {"i", 24}
72-
}. All these cuts are optional.
68+
"min_image_separation": 0.5,
69+
"max_image_separation": 10,
70+
"mag_arc_limit": {"i": 24},
71+
"second_brightest_image_cut": {"i": 24}}.
72+
All these cuts are optional.
7373
:type kwargs_lens_cut: dict
7474
:param verbose: print statements added
7575
:type verbose: bool

0 commit comments

Comments
 (0)