Closed cjordan closed 5 years ago
I've just pushed a change that gives an error if the file can't be found - it still sets freqs to an empty list and returns though, so it'll still fail later with the same TypeError. Not sure whether to call sys.exit(-1) if the h5 file isn't found, or to raise an AssertionError at the point where it looks for the file?
I got the impression that if the h5 file isn't available, then some other beam was used? If that's wrong, then this code should (IMO) throw an exception, otherwise it prints a warning and uses another beam.
I've just pushed a version that raises an IOError instead. There's no way that the primary_beam.MWA_Tile_full_EE() function can succeed if the h5 file doesn't exist. If that function throws an exception (because the h5 file with the full EE model can't be found) then it's up to Jack's code in /srclists/srclist_by_beam.py to call a different beam model function, like primary_beam.MWA_Tile_analytic().
I would attempt to fix this myself, but I'm getting a headache looking at the code. To reproduce:
pip install .
Sprinkling some prints in
beam_full_EE.py
shows thatif h5filepath == config.h5file:
evaluates true, and that code then setsfreqs
to an empty list (and not a numpy array). The next condition iselif os.path.exists(h5filepath):
, and it seems to me that these conditions need to be somehow merged, as putting the h5 file in the expected location (/home/chj/miniconda2/lib/python2.7/site-packages/mwa_pb/data/mwa_full_embedded_element_pattern.h5
) fixes the type error.