RadioAstronomySoftwareGroup / pyuvsim

A ultra-high precision package for simulating radio interferometers in python on compute clusters.
https://pyuvsim.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
43 stars 7 forks source link

Potential bug in PyPI package (v1.2.0) #366

Closed piyanatk closed 2 years ago

piyanatk commented 2 years ago

I recently opened this issue on pyradiosky repository. After more testing, the issue points to a potential bug in the PyPI package (v1.2.0). In summary, the PyPI package produce the following exception in pyuvsim.simsetup.initialize_catalog_from_params give an obsparams file and a sky model.

Traceback (most recent call last):
  File "h1c-idr3-sim-test.py", line 178, in <module>
    sky_model, _ = simsetup.initialize_catalog_from_params(obs_params, return_recarray=False)
  File "/Users/piyanat/src/miniconda3/envs/pyuvsim_test2/lib/python3.8/site-packages/pyuvsim/simsetup.py", line 716, in initialize_catalog_from_params
    sky.source_cuts(**source_select_kwds)
  File "/Users/piyanat/src/miniconda3/envs/pyuvsim_test2/lib/python3.8/site-packages/pyradiosky/skymodel.py", line 1986, in source_cuts
    skyobj.check(
  File "/Users/piyanat/src/miniconda3/envs/pyuvsim_test2/lib/python3.8/site-packages/pyradiosky/skymodel.py", line 820, in check
    param_unit = param.value.unit
AttributeError: 'NoneType' object has no attribute 'unit'

The MWE is attached. Please check the README in the tarball for details. The std log from my test is included.

h1c-idr3-sim-test.tar.gz

bhazelton commented 2 years ago

This is very strange. Thanks for hunting it further, I'll try to dig into this soon.

bhazelton commented 2 years ago

Ok, I figured it out. The issue is that the last tagged version of pyuvsim (which is what is on pipy) doesn't support skyh5 files because it's rather old. So it never actually reads in the file at all and then it errors because the catalog is just an empty SkyModel object (with all the attributes on it set to None).

The solution is to make a new pyuvsim release, which I will try to get out shortly. In the meantime, using the latest version from the repo also works.

Sorry this took awhile to sort out, I had issues getting onto NRAO to get the file.

piyanatk commented 2 years ago

@bhazelton Thank you for digging in to this.

bhazelton commented 2 years ago

We just pushed a new release, v1.2.1, to pypi, so this should be resolved.