Skip to content

Commit

Permalink
keep notebook output but remove metadata with nbstripout (#266)
Browse files Browse the repository at this point in the history
* keep output but remove metadata

* add nbstripout to pre-commit

* add nbstripout to dependencies

* keep output nbstripout

* error corrected

* autoupdate

* update poetry

* black

* black should be latest version
  • Loading branch information
ismael-mendoza committed Feb 25, 2022
1 parent cd6b0dd commit 94cc3e0
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 494 deletions.
16 changes: 11 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.1.0
hooks:
- id: trailing-whitespace
exclude: ^.*fits
Expand All @@ -14,18 +14,18 @@ repos:
- id: end-of-file-fixer
exclude: ^.*fits
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.1.0
hooks:
- id: black
language_version: python3
args:
- "--line-length=100"
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0
rev: v2.7.1
hooks:
- id: reorder-python-imports
- repo: https://github.com/pycqa/flake8
rev: 3.8.4
rev: 4.0.1
hooks:
- id: flake8
args: # arguments to configure flake8
Expand All @@ -35,7 +35,7 @@ repos:
- "--ignore=E203, W503"
- "--exclude=btk/__init__.py"
- repo: https://github.com/pycqa/pydocstyle
rev: 6.0.0 # pick a git hash / tag to point to
rev: 6.1.1 # pick a git hash / tag to point to
hooks:
- id: pydocstyle
args:
Expand All @@ -46,3 +46,9 @@ repos:
^conftest.py|
^tests/
)
- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
hooks:
- id: nbstripout
args:
- --keep-output
2 changes: 1 addition & 1 deletion btk/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _prepare_table(self, raw_catalog):
)
r_sec = np.hypot(
raw_catalog["a_d"] * (1 - f) ** 0.5 * 4.66,
raw_catalog["a_b"] * f ** 0.5 * 1.46,
raw_catalog["a_b"] * f**0.5 * 1.46,
)
# BTK now requires ref_mags, but Catsim still wants magnitudes
table["ref_mag"] = raw_catalog["i_ab"]
Expand Down
2 changes: 1 addition & 1 deletion btk/sampling_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def __call__(self, table, **kwargs):
blend_table["ra"] = 0.0
blend_table["dec"] = 0.0
# keep number density of objects constant
maxshift = self.stamp_size / 30.0 * number_of_objects ** 0.5
maxshift = self.stamp_size / 30.0 * number_of_objects**0.5
x_peak, y_peak = _get_random_center_shift(number_of_objects + 1, maxshift, self.rng)
blend_table["ra"] += x_peak
blend_table["dec"] += y_peak
Expand Down
2 changes: 1 addition & 1 deletion btk/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def get_mean_sky_level(survey, filt):
Returns:
Corresponding mean sky level
"""
return get_flux(filt.sky_brightness, filt, survey) * survey.pixel_scale ** 2
return get_flux(filt.sky_brightness, filt, survey) * survey.pixel_scale**2


def make_wcs(pixel_scale, shape, center_pix=None, center_sky=None, projection="TAN"):
Expand Down
Loading

0 comments on commit 94cc3e0

Please sign in to comment.