You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a data cube with only one exposure (i.e. cube.shape[0]==1), I encountered two errors in extract_bs():
An IndexError if clipping had been done before and rejected the only frame in in the cube and extract_bs() had an empty input.
Error message
bs = amical.extract_bs(
File "/home/vandal/projects/amical/amical/mf_pipeline/bispect.py", line 1138, in extract_bs
ft_arr, n_ps, npix = _construct_ft_arr(cube)
File "/home/vandal/projects/amical/amical/mf_pipeline/bispect.py", line 227, in _construct_ft_arr
n_pix = cube.shape[1]
IndexError: tuple index out of range
A ZeroDivisionError if no clipping was done and extract_bs() received a cube with one frame.
Error message
bs = amical.extract_bs(
File "/home/vandal/projects/amical/amical/mf_pipeline/bispect.py", line 1242, in extract_bs
v2_quantities = _compute_v2_quantities(v2_arr_unbiased, bias_arr, n_blocks)
File "/home/vandal/projects/amical/amical/mf_pipeline/bispect.py", line 537, in _compute_v2_quantities
ind2 = (k + 1) * n_ps // (n_blocks - 1)
ZeroDivisionError: integer division or modulo by zero
As discussed with @DrSoulain, this should not occur often and is currently not supported. It might still be worth adding an error to catch these two cases in extract_bs and raise a more informative error message to clarify what is happening.
The text was updated successfully, but these errors were encountered:
Yes! extract_bs() needs a file, so I'm using one of the example files in doc/NRM_DATA. This works on my machine from the amical/doc directory:
frompathlibimportPathfromastropy.ioimportfitsfromamicalimportextract_bsfromamical.data_processingimportselect_dataeg_file=Path("NRM_DATA/t_binary_s=147.7mas_mag=6.0_dm=6.0_posang=46.6__F430M_81_flat_x11__00.fits")
data=fits.getdata(eg_file)[:1]
# Uncomment this line to get the IndexError in extract_bs# data = select_data(data, clip=True, display=False)extract_bs(data, eg_file, "g7")
select_data shows a warning if it clears a data cube of all its exposures (to let users know, even in cases where nothing is done with the cube after. An empty cube is probably not desirable, but not critical in the sense that users can just check for this and skip empty cubes
extract_bs() check both cases (length 1 or empty) and raises and error. The two cases are critical for extraction, and result in error in private functions called by extract_bs()
When using a data cube with only one exposure (i.e.
cube.shape[0]==1
), I encountered two errors inextract_bs()
:An
IndexError
if clipping had been done before and rejected the only frame in in the cube andextract_bs()
had an empty input.Error message
A
ZeroDivisionError
if no clipping was done andextract_bs()
received a cube with one frame.Error message
As discussed with @DrSoulain, this should not occur often and is currently not supported. It might still be worth adding an error to catch these two cases in
extract_bs
and raise a more informative error message to clarify what is happening.The text was updated successfully, but these errors were encountered: