Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve handling for future pyuvdata #915

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions hera_cal/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os
import copy
import warnings
from packaging import version
import inspect
from functools import reduce
from collections.abc import Iterable
from pyuvdata import UVCal, UVData
Expand Down Expand Up @@ -1032,19 +1032,18 @@
# else: # make a copy of this object and then update the relevant arrays using DataContainers
# this = copy.deepcopy(self)

if version.parse(pyuvdata.__version__) < version.parse("3.0"):
hd_writer.write_uvh5_part(output_path, d, f, n,
run_check_acceptability=(output_path in self._writers),
**self.last_read_kwargs)
write_kwargs = {
"data_array": d,
"nsample_array": n,
"run_check_acceptability": (output_path in self._writers),
**self.last_read_kwargs,
}
# before pyuvdata 3.0, the "flag_array" parameter was called "flags_array"
if "flag_array" in inspect.signature(UVData.write_uvh5_part).parameters:
write_kwargs["flag_array"] = f

Check warning on line 1043 in hera_cal/io.py

View check run for this annotation

Codecov / codecov/patch

hera_cal/io.py#L1043

Added line #L1043 was not covered by tests
else:
hd_writer.write_uvh5_part(
output_path,
data_array=d,
flag_array=f,
nsample_array=n,
run_check_acceptability=(output_path in self._writers),
**self.last_read_kwargs
)
write_kwargs["flags_array"] = f
hd_writer.write_uvh5_part(output_path, **write_kwargs)

def iterate_over_bls(self, Nbls=1, bls=None, chunk_by_redundant_group=False, reds=None,
bl_error_tol=1.0, include_autos=True, frequencies=None):
Expand Down