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

Sum/Diff vis checks are a little too strict #1360

Open
mkolopanis opened this issue Nov 17, 2023 · 1 comment
Open

Sum/Diff vis checks are a little too strict #1360

mkolopanis opened this issue Nov 17, 2023 · 1 comment

Comments

@mkolopanis
Copy link
Member

the sum_vis/diff_vis functions require all parameters to be the same to difference or add two sets of visibilities. This includes the filename parameter, which we can expect to differ for things we want to perform these operations with. While telescope, time, freq, etc should all match I think we can make an exception for the filename.

In [2]: uvd_data = UVData.from_file("mmode_one_time_high_band.uvh5")
uvd_offset =  UVData.from_file("mmode_flux_offset.uvh5")
In [3]: uvd_offset =  UVData.from_file("mmode_flux_offset.uvh5")

In [4]: uvd_data.diff_vis?

In [5]: uvd_diff = uvd_data.diff_vis(uvd_offset)
filename parameter value is a list of strings, values are different
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-e939de554361> in ?()
----> 1 uvd_diff = uvd_data.diff_vis(uvd_offset)

/opt/devel/mkolopanis/envs/vis_cpu/lib/python3.11/site-packages/pyuvdata/uvdata/uvdata.py in ?(self, other, inplace, run_check, check_extra, run_check_acceptability, strict_uvw_antpos_check, override_params)
   7691                 strict_uvw_antpos_check=strict_uvw_antpos_check,
   7692                 override_params=override_params,
   7693             )
   7694         else:
-> 7695             return self.sum_vis(
   7696                 other,
   7697                 difference=True,
   7698                 inplace=inplace,

/opt/devel/mkolopanis/envs/vis_cpu/lib/python3.11/site-packages/pyuvdata/uvdata/uvdata.py in ?(self, other, inplace, difference, verbose_history, run_check, check_extra, run_check_acceptability, strict_uvw_antpos_check, override_params)
   7571                 msg = (
   7572                     "UVParameter " + param[1:] + " does not match. Cannot "
   7573                     "combine objects."
   7574                 )
-> 7575                 raise ValueError(msg)
   7576 
   7577         # Merge extra keywords
   7578         for intersection in set(this.extra_keywords.keys()) & set(

ValueError: UVParameter filename does not match. Cannot combine objects.
@bhazelton
Copy link
Member

Yes, I agree. We have some exceptions for other parameters, I think we just need to add filename to that list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants