Skip to content

Commit 6f03ee6

Browse files
committed
isort
1 parent 79aa22d commit 6f03ee6

File tree

432 files changed

+4467
-9054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+4467
-9054
lines changed

doc/conf.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import List
44

55
import lsst_sphinx_bootstrap_theme
6-
76
from documenteer.sphinxconfig.utils import form_ltd_edition_name
87

98
# Work around Sphinx bug related to large and highly-nested source files
@@ -43,9 +42,7 @@
4342

4443
# General information about the project.
4544
project = "rubin_sim"
46-
copyright = (
47-
"2015-2022 " "Association of Universities for Research in Astronomy, Inc. (AURA)"
48-
)
45+
copyright = "2015-2022 " "Association of Universities for Research in Astronomy, Inc. (AURA)"
4946
author = "LSST Survey Strategy Team"
5047

5148
# The version info for the project you're documenting, acts as replacement for
@@ -57,9 +54,7 @@
5754
release = version
5855
else:
5956
# Use branch name as the version tag
60-
version = form_ltd_edition_name(
61-
git_ref_name=os.getenv("TRAVIS_BRANCH", default="main")
62-
)
57+
version = form_ltd_edition_name(git_ref_name=os.getenv("TRAVIS_BRANCH", default="main"))
6358
release = version
6459

6560
# The language for content autogenerated by Sphinx. Refer to documentation

doc/metric_list.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import inspect
2-
import rubin_sim.maf.metrics as metrics
2+
33
import rubin_sim.maf.maf_contrib as maf_contrib
4+
import rubin_sim.maf.metrics as metrics
45

56
__all__ = ["make_metric_list"]
67

@@ -35,9 +36,7 @@ def make_metric_list(outfile):
3536
for name, obj in inspect.getmembers(maf_contrib):
3637
if inspect.isclass(obj):
3738
modname = inspect.getmodule(obj).__name__
38-
if modname.startswith("rubin_sim.maf.maf_contrib") and name.endswith(
39-
"Metric"
40-
):
39+
if modname.startswith("rubin_sim.maf.maf_contrib") and name.endswith("Metric"):
4140
link = f":py:class:`~rubin_sim.maf.maf_contrib.{name}` "
4241
simpledoc = inspect.getdoc(obj).split("\n")[0]
4342
print(f"- {link} \n \t {simpledoc}", file=f)

pyproject.toml

+49
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,52 @@ asyncio_mode = "auto"
6464
disallow_untyped_defs = "True"
6565
ignore_missing_imports = "True"
6666
exclude = "version.py"
67+
68+
[tool.black]
69+
line-length = 110
70+
target-version = ["py310"]
71+
72+
[tool.isort]
73+
profile = "black"
74+
line_length = 110
75+
76+
[tool.ruff]
77+
exclude = [
78+
"__init__.py",
79+
]
80+
ignore = [
81+
"N802",
82+
"N803",
83+
"N806",
84+
"N812",
85+
"N815",
86+
"N816",
87+
"N999",
88+
"D107",
89+
"D105",
90+
"D102",
91+
"D104",
92+
"D100",
93+
"D200",
94+
"D205",
95+
"D400",
96+
]
97+
line-length = 110
98+
select = [
99+
"E", # pycodestyle
100+
"F", # pyflakes
101+
"N", # pep8-naming
102+
"W", # pycodestyle
103+
#"D", # pydocstyle
104+
]
105+
target-version = "py310"
106+
extend-select = [
107+
"RUF100", # Warn about unused noqa
108+
]
109+
110+
[tool.ruff.pycodestyle]
111+
max-doc-length = 79
112+
113+
[tool.ruff.pydocstyle]
114+
convention = "numpy"
115+

rubin_sim/data/data_sets.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import glob
12
import os
2-
import warnings
33
import subprocess
4-
import glob
5-
4+
import warnings
65

76
__all__ = ["get_data_dir", "data_versions", "get_baseline"]
87

rubin_sim/data/rs_download_data.py

+10-21
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#!/usr/bin/env python
2+
import argparse
23
import os
34
import warnings
5+
from shutil import rmtree, unpack_archive
6+
47
import requests
58
from requests.exceptions import ConnectionError
6-
import argparse
79
from tqdm.auto import tqdm
8-
from shutil import unpack_archive, rmtree
910

10-
from .data_sets import get_data_dir, data_versions
11+
from .data_sets import data_versions, get_data_dir
1112

1213
DEFAULT_DATA_URL = "https://s3df.slac.stanford.edu/data/rubin/sim-data/rubin_sim_data/"
13-
BACKUP_DATA_URL = (
14-
"https://epyc.astro.washington.edu/~lynnej/opsim_downloads/rubin_sim_data/"
15-
)
14+
BACKUP_DATA_URL = "https://epyc.astro.washington.edu/~lynnej/opsim_downloads/rubin_sim_data/"
1615

1716

1817
def data_dict():
@@ -42,9 +41,7 @@ def rs_download_data():
4241
"""Download data."""
4342

4443
files = data_dict()
45-
parser = argparse.ArgumentParser(
46-
description="Download data files for rubin_sim package"
47-
)
44+
parser = argparse.ArgumentParser(description="Download data files for rubin_sim package")
4845
parser.add_argument(
4946
"--versions",
5047
dest="versions",
@@ -132,9 +129,7 @@ def rs_download_data():
132129
print(f"Could not connect to {args.url_base}; trying {url_base}")
133130
try:
134131
r = requests.get(url_base)
135-
fail_message = (
136-
f"Could not connect to {args.url_base} or {url_base}. Check sites are up?"
137-
)
132+
fail_message = f"Could not connect to {args.url_base} or {url_base}. Check sites are up?"
138133
except ConnectionError:
139134
print(fail_message)
140135
exit()
@@ -150,9 +145,7 @@ def rs_download_data():
150145
else:
151146
if os.path.isdir(path) and args.force:
152147
rmtree(path)
153-
warnings.warn(
154-
"Removed existing directory %s, downloading new copy" % path
155-
)
148+
warnings.warn("Removed existing directory %s, downloading new copy" % path)
156149
# Download file
157150
url = url_base + filename
158151
print("Downloading file: %s" % url)
@@ -161,12 +154,8 @@ def rs_download_data():
161154
file_size = int(r.headers.get("Content-Length", 0))
162155
if file_size < 245:
163156
warnings.warn(f"{url} file size unexpectedly small.")
164-
block_size = (
165-
1024 * 1024
166-
) # download this size chunk at a time; reasonable guess
167-
progress_bar = tqdm(
168-
total=file_size, unit="iB", unit_scale=True, disable=args.tdqm_disable
169-
)
157+
block_size = 1024 * 1024 # download this size chunk at a time; reasonable guess
158+
progress_bar = tqdm(total=file_size, unit="iB", unit_scale=True, disable=args.tdqm_disable)
170159
print(f"Writing to {os.path.join(data_dir, filename)}")
171160
with open(os.path.join(data_dir, filename), "wb") as f:
172161
for chunk in r.iter_content(chunk_size=block_size):

rubin_sim/data/rs_download_sky.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env python
2-
import os
3-
import requests
42
import argparse
3+
import os
54
from html.parser import HTMLParser
65

6+
import requests
7+
78
from . import get_data_dir
89

910

rubin_sim/maf/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
#
2222
"""Python interface to the metrics analysis framework.
2323
"""
24+
from .batches import *
2425
from .db import *
26+
from .maf_contrib import *
27+
from .maps import *
28+
from .metric_bundles import *
2529
from .metrics import *
30+
from .plots import *
31+
from .run_comparison import *
2632
from .slicers import *
2733
from .stackers import *
28-
from .metric_bundles import *
29-
from .maps import *
30-
from .plots import *
3134
from .utils import *
32-
from .batches import *
33-
from .run_comparison import *
3435
from .web import *
35-
from .maf_contrib import *

rubin_sim/maf/batches/__init__.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
from .altaz_batch import *
12
from .col_map_dict import *
23
from .common import *
3-
from .slew_batch import *
4-
from .time_batch import *
5-
from .metadata_batch import *
6-
from .visitdepth_batch import *
7-
from .hourglass_batch import *
8-
from .glance_batch import *
4+
from .ddf_batch import *
95
from .filterchange_batch import *
10-
from .openshutter_batch import *
11-
from .skycoverage import *
12-
from .altaz_batch import *
6+
from .glance_batch import *
7+
from .hourglass_batch import *
8+
from .info_batch import *
9+
from .metadata_batch import *
1310
from .moving_objects_batch import *
11+
from .openshutter_batch import *
1412
from .science_radar_batch import *
15-
from .ddf_batch import *
13+
from .skycoverage import *
14+
from .slew_batch import *
1615
from .srd_batch import *
17-
from .info_batch import *
16+
from .time_batch import *
17+
from .visitdepth_batch import *

rubin_sim/maf/batches/altaz_batch.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import rubin_sim.maf.metrics as metrics
2-
import rubin_sim.maf.slicers as slicers
31
import rubin_sim.maf.metric_bundles as mb
2+
import rubin_sim.maf.metrics as metrics
43
import rubin_sim.maf.plots as plots
4+
import rubin_sim.maf.slicers as slicers
5+
56
from .col_map_dict import col_map_dict
67
from .common import filter_list
78

@@ -74,8 +75,7 @@ def altazHealpix(
7475
"group": "Alt/Az",
7576
"order": orders[f],
7677
"subgroup": subgroup,
77-
"caption": "Pointing History on the alt-az sky (zenith center) for filter %s"
78-
% f,
78+
"caption": "Pointing History on the alt-az sky (zenith center) for filter %s" % f,
7979
}
8080
bundle = mb.MetricBundle(
8181
metric,

rubin_sim/maf/batches/common.py

+10-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function
2+
23
import inspect
34

45
import rubin_sim.maf.metrics as metrics
@@ -211,12 +212,8 @@ def extended_metrics(colname, replace_colname=None):
211212
extendedMetrics = standard_metrics(colname, replace_colname=None)
212213
extendedMetrics += [
213214
metrics.RmsMetric(colname),
214-
metrics.NoutliersNsigmaMetric(
215-
colname, metric_name="N(+3Sigma) " + colname, n_sigma=3
216-
),
217-
metrics.NoutliersNsigmaMetric(
218-
colname, metric_name="N(-3Sigma) " + colname, n_sigma=-3
219-
),
215+
metrics.NoutliersNsigmaMetric(colname, metric_name="N(+3Sigma) " + colname, n_sigma=3),
216+
metrics.NoutliersNsigmaMetric(colname, metric_name="N(-3Sigma) " + colname, n_sigma=-3),
220217
metrics.PercentileMetric(colname, percentile=25),
221218
metrics.PercentileMetric(colname, percentile=75),
222219
metrics.CountMetric(colname),
@@ -282,12 +279,8 @@ def summary_completeness_at_time(times, h_val, h_index=0.33):
282279
List of moving object MoCompletenessAtTime metrics (cumulative and differential)
283280
"""
284281
summaryMetrics = [
285-
metrics.MoCompletenessAtTimeMetric(
286-
times=times, hval=h_val, hindex=h_index, cumulative=False
287-
),
288-
metrics.MoCompletenessAtTimeMetric(
289-
times=times, hval=h_val, hindex=h_index, cumulative=True
290-
),
282+
metrics.MoCompletenessAtTimeMetric(times=times, hval=h_val, hindex=h_index, cumulative=False),
283+
metrics.MoCompletenessAtTimeMetric(times=times, hval=h_val, hindex=h_index, cumulative=True),
291284
]
292285
return summaryMetrics
293286

@@ -308,12 +301,8 @@ def summary_completeness_over_h(requiredChances=1, Hindex=0.33):
308301
List of moving object MoCompleteness metrics (cumulative and differential)
309302
"""
310303
summaryMetrics = [
311-
metrics.MoCompletenessMetric(
312-
threshold=requiredChances, cumulative=False, hindex=Hindex
313-
),
314-
metrics.MoCompletenessMetric(
315-
threshold=requiredChances, cumulative=True, hindex=Hindex
316-
),
304+
metrics.MoCompletenessMetric(threshold=requiredChances, cumulative=False, hindex=Hindex),
305+
metrics.MoCompletenessMetric(threshold=requiredChances, cumulative=True, hindex=Hindex),
317306
]
318307
return summaryMetrics
319308

@@ -357,12 +346,8 @@ def microlensing_summary(metric_type, npts_required=10, Fisher_sigmatE_tE_cutoff
357346
),
358347
metrics.CountMetric(metric_name="Total lightcurves in footprint"),
359348
metrics.CountMetric(metric_name="Total lightcurves on sky", mask_val=0),
360-
metrics.MeanMetric(
361-
metric_name="Mean number of points per lightcurves in footprint"
362-
),
363-
metrics.MeanMetric(
364-
mask_val=0, metric_name="Mean number of points per lightcurves in total"
365-
),
349+
metrics.MeanMetric(metric_name="Mean number of points per lightcurves in footprint"),
350+
metrics.MeanMetric(mask_val=0, metric_name="Mean number of points per lightcurves in total"),
366351
]
367352
elif metric_type == "Fisher":
368353
microlensingSummary = [
@@ -373,8 +358,6 @@ def microlensing_summary(metric_type, npts_required=10, Fisher_sigmatE_tE_cutoff
373358
metrics.CountMetric(metric_name="Total lightcurves in footprint"),
374359
metrics.CountMetric(metric_name="Total lightcurves on sky", mask_val=0),
375360
metrics.RealMeanMetric(metric_name="Mean sigma_tE/tE in footprint (mean)"),
376-
metrics.RealMeanMetric(
377-
mask_val=0, metric_name="Mean sigma_tE/tE of total (mean)"
378-
),
361+
metrics.RealMeanMetric(mask_val=0, metric_name="Mean sigma_tE/tE of total (mean)"),
379362
]
380363
return microlensingSummary

0 commit comments

Comments
 (0)