Skip to content

Commit

Permalink
style: apply pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Jul 9, 2024
1 parent 910ad21 commit d99df92
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ omit =
*/tests/*
*/data/*
*/scripts/*

[report]
omit =
*/tests/*
*/data/*
*/scripts/*
*/scripts/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ hera_qm/data/test_output/ant_metrics_output.json
hera_qm/_version.py

artifacts/*
result.md
result.md
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
exclude: '(^docs/conf.py|^hera_qm/data/|.codecov.yml)'

ci:
autoupdate_schedule: monthly

Expand Down
6 changes: 3 additions & 3 deletions hera_qm/metrics_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ def _recursively_save_dict_to_group(h5file, path, in_dict):
"""
allowed_types = (np.ndarray, np.float32, float, int,
bytes, str, list, bool, np.bool_)


compressable_types = (np.ndarray, list)
for key in in_dict:
# Catch case with numpy 2 where keys of type (np.int32(ant), 'polstr')) are
# Catch case with numpy 2 where keys of type (np.int32(ant), 'polstr')) are
# converted to string with the full np.int32 identifier in them.
if isinstance(key, tuple):
key = tuple(int(k) if isinstance(k, (int, np.int32, np.int64)) else k for k in key)
Expand Down
1 change: 0 additions & 1 deletion hera_qm/omnical_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import json
import copy
import os
import warnings


def get_omnical_metrics_dict():
Expand Down
4 changes: 2 additions & 2 deletions hera_qm/tests/test_ant_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@ def test_ant_metrics_run_and_load_antenna_metrics():
# test a priori flagging via YAML
four_pol_uvh5 = DATA_PATH + '/zen.2457698.40355.full_pol_test.uvh5'
apf_yaml = os.path.join(DATA_PATH, 'a_priori_flags_sample.yaml')

# SGM: not sure if the following warning *should* be raised.
with pytest.warns(RuntimeWarning, match='All-NaN slice encountered'):
am = ant_metrics.ant_metrics_run(four_pol_uvh5, diff_files=four_pol_uvh5, overwrite=True, a_priori_xants_yaml=apf_yaml, verbose=True)

am_hdf5 = ant_metrics.load_antenna_metrics(four_pol_uvh5.replace('.uvh5', '.ant_metrics.hdf5'))
for ant in [(0, 'Jee'), (0, 'Jnn'), (10, 'Jee'), (10, 'Jnn'), (1, 'Jee'), (3, 'Jnn')]:
assert ant in am_hdf5['xants']
Expand Down
2 changes: 1 addition & 1 deletion hera_qm/tests/test_auto_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def test_auto_metrics_run():
warnings.filterwarnings("ignore", message="K1 value 8 is larger than the data of dimension 4; using the size of the data for the kernel size")
warnings.filterwarnings("ignore", message="Mean of empty slice")
warnings.filterwarnings("ignore", message="Degrees of freedom <= 0 for slice")

ex_ants, modzs, spectra, flags = auto_metrics.auto_metrics_run(metrics_outfile, auto_files,
median_round_modz_cut=75., mean_round_modz_cut=5.,
edge_cut=100, Kt=8, Kf=8, sig_init=5.0, sig_adj=2.0,
Expand Down
2 changes: 1 addition & 1 deletion hera_qm/tests/test_xrfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ def test_xrfi_run_step(tmpdir):
assert np.all(np.isclose(uvf_a1.flag_array, uvf_a2.flag_array))
assert np.all(np.isclose(uvf1.metric_array, uvf2.metric_array, atol=1e-5, rtol=1e-5))
# hit one line involving uvcal reinitialization and include yaml file.

with pytest.warns(RuntimeWarning, match="invalid value encountered in subtract"):
xrfi.xrfi_run_step(uv_files=ocal_file, calculate_uvf_apriori=True, run_filter=True, reinitialize=True, a_priori_flag_yaml=a_priori_flag_integrations)
# test invalid data type error
Expand Down

0 comments on commit d99df92

Please sign in to comment.