Skip to content

Cannot Run Using Original *_mask_limit Options #47

Description

@jmangum

Trying to debug no signal masking results by running (original) behavior whereby one masks to a signal_mask_limit and spatial_mask_limit of N*sigma. Using YAML file below, which is copied from a previous run of CubeLineMoment which did work, get the following error:

In [5]: run ~/Python/mangum_galaxies-master/CubeLineMoment.py HCN32.yaml
WARNING: StokesWarning: Cube is a Stokes cube, returning spectral cube for I component [spectral_cube.io.core]
WARNING: StokesWarning: Cube is a Stokes cube, returning spectral cube for I component [spectral_cube.io.core]
WARNING: PossiblySlowWarning: This function (<function BaseSpectralCube.argmax at 0x198003c10>) requires loading the entire cube into memory and may therefore be slow. [spectral_cube.utils]
WARNING: PossiblySlowWarning: This function (<function BaseSpectralCube.max at 0x1980038b0>) requires loading the entire cube into memory and may therefore be slow. [spectral_cube.utils]
/Users/jmangum/anaconda3/envs/python39/lib/python3.9/site-packages/spectral_cube/spectral_cube.py:441: RuntimeWarning: All-NaN slice encountered
  out = function(self._get_filled_data(fill=fill,
/Users/jmangum/anaconda3/envs/python39/lib/python3.9/site-packages/numpy/lib/nanfunctions.py:1878: RuntimeWarning: Degrees of freedom <= 0 for slice.
  var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
noisemapbright peak = 0.02993866242468357 Jy / beam
WARNING: Spatial mask limit results in 180468 masked out pixels [__main__]
/Users/jmangum/anaconda3/envs/python39/lib/python3.9/site-packages/numpy/lib/nanfunctions.py:1878: RuntimeWarning: Degrees of freedom <= 0 for slice.
  var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
/Users/jmangum/Python/mangum_galaxies-master/CubeLineMoment.py:476: UserWarning: Found minimum width in width_map 0.0 km / s.
  warnings.warn(f"Found minimum width in width_map {np.nanmin(width_map)}.")

INFO: Line: HCN_32, 265.88618 GHz, 120.0 km / s [__main__]
/Users/jmangum/Python/mangum_galaxies-master/CubeLineMoment.py:530: RuntimeWarning: divide by zero encountered in divide
  gauss_mask_cube = np.exp(-(np.array(velocity_map)[None,:,:] -
Peak S/N: 1273.1158447265625
Minimum S/N: 0.4789569675922394
Highest Threshold: 2.0878703594207764
Lowest Positive Threshold: 0.000785474490839988
Lowest Threshold: 0.000785474490839988
Sample Pixel =  (375, 436, 'Region 6')
SP Threshold: 0.0941363051533699
SP S, N, S/N: 0.015526569448411465 Jy / beam, 0.0014616138068959117 Jy / beam, 10.622894287109375
There were 18182 zero peaks
Number of values above threshold: 8446226
Number of spatial pixels excluded: 246923 out  of 613089
Number of spatial pixels excluded in spatially included region: 115553 out  of 481719
Min, Max value in the mask cube: 0.0,1.0
shapes: mask cube=(74, 783, 783)  threshold: (783, 783)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
File ~/Python/mangum_galaxies-master/CubeLineMoment.py:1032, in <module>
   1028     return locals()
   1031 if __name__ == "__main__":
-> 1032     new_locals = main()
   1033     locals().update(new_locals)

File ~/Python/mangum_galaxies-master/CubeLineMoment.py:982, in main()
    978 params.pop('cube')
    979 params.pop('sample_pixel')
--> 982 cubelinemoment_multiline(cube=cube, spatial_mask=spatial_mask,
    983                          peak_velocity=peak_velocity,
    984                          centroid_map=centroid_map, max_map=max_map,
    985                          noisemap=noisemap, noisemapbright=noisemapbright,
    986                          width_map=width_map, sample_pixel=sample_pixel,
    987                          fit=False, **params)
    989 # params.pop('signal_mask_limit')
    990 # cubelinemoment_multiline(cube=cube, spatial_mask=spatial_mask,
    991 #                          peak_velocity=peak_velocity,
   (...)
   1015
   1016 # Clean up open figures
   1017 pl.close('all')

File ~/Python/mangum_galaxies-master/CubeLineMoment.py:620, in cubelinemoment_multiline(cube, peak_velocity, centroid_map, max_map, noisemap, noisemapbright, signal_mask_limit, spatial_mask_limit, brightest_line_name, brightest_line_frequency, my_line_list, my_line_widths, my_line_names, target, spatial_mask, width_map, sample_pixel, width_map_scaling, width_cut_scaling, use_default_width, fit, apply_width_mask, min_width, min_gauss_threshold, max_gauss_threshold, use_peak_for_velcut, debug, **kwargs)
    618 spatially_masked_pixels = ~((subcube.mask.include() & width_mask_cube).any(axis=0))
    619 spatially_masked_pixels2 = ~msubcube.mask.include().any(axis=0)
--> 620 assert np.all(spatially_masked_pixels == (spatially_masked_pixels2)), f"{(spatially_masked_pixels).sum()} != {(spatially_masked_pixels2).sum()}"
    621 assert (spatially_masked_pixels).sum() == (spatially_masked_pixels2).sum()
    622 if debug:

AssertionError: 246923 != 441709

YAML file:

cube: /Users/jmangum/Science/ALCHEMI/ALCHEMIHighResBand67/Imaging/ngc253_h_06_TM1/spw29/uid___A001_X133d_X1579.ngc253_sci.spw29.cube.selfcal.I.fits
cuberegion: CubeLineMoment.reg
cutoutcube: /Users/jmangum/Science/ALCHEMI/ALCHEMIHighResBand67/Imaging/ngc253_h_06_TM1/spw29/uid___A001_X133d_X1579.ngc253_sci.spw29.cube.selfcal.I.fits
cutoutcuberegion: CubeLineMoment.reg
vz: 236
target: NGC253
brightest_line_name: HCN_32
brightest_line_frequency: 265.88618
width_line_frequency: 265.88618
velocity_half_range: 250
noisemapbright_baseline: [[24,26],[82,86]]
noisemap_baseline: [[24,26],[82,86]]
my_line_list: 265.88618
my_line_widths: 120
my_line_names: HCN_32
signal_mask_limit: 3
spatial_mask_limit: 3
sample_pixel: Region6.reg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions