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

Minor errors (and fixes) from ASKAP processing #1

Open
mattwhiting opened this issue Jan 29, 2019 · 0 comments
Open

Minor errors (and fixes) from ASKAP processing #1

mattwhiting opened this issue Jan 29, 2019 · 0 comments

Comments

@mattwhiting
Copy link

Here are a couple of errors that had cropped up in debugging some ASKAP processing. One was

Traceback (most recent call last):
File "/group/askap/acesops/ACES-r48219/UserScripts/col52r/ASKAP_continuum_validation.py", line 153, in
AKcat.set_specs(AK)
File "/group/askap/acesops/ACES-r48219/UserScripts/col52r/catalogue.py", line 344, in set_specs
self.img_peak_rms = rms_map.data[self.img_peak_pos][0]
IndexError: index 0 is out of bounds for axis 0 with size 0

and another, similar one was

Traceback (most recent call last):
File "/group/askap/acesops/ACES-r48219/UserScripts/col52r/ASKAP_continuum_validation.py", line 153, in
AKcat.set_specs(AK)
File "/group/askap/acesops/ACES-r48219/UserScripts/col52r/catalogue.py", line 339, in set_specs
self.img_peak = np.max(img_data[~np.isnan(img_data)])
File "/pawsey/cle60up05/python/2.7.14/numpy/1.13.3/lib/python2.7/site-packages/numpy-1.13.3-py2.7-linux-x86_64.egg/numpy/core/fromnumeric.py", line 2272, in amax
out=out, **kwargs)
File "/pawsey/cle60up05/python/2.7.14/numpy/1.13.3/lib/python2.7/site-packages/numpy-1.13.3-py2.7-linux-x86_64.egg/numpy/core/_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity

These are related to, I think, spurious values, but simple tests will allow you to proceed. I have checked in the following changes to the ASKAP subversion repo, but you may want to do the same here (and there may be more - this was enough to get things going):

Index: catalogue.py
===================================================================
--- catalogue.py	(revision 48353)
+++ catalogue.py	(working copy)
@@ -341,7 +341,10 @@
         self.img_rms = int(np.median(rms_map.data[self.rms_bounds])*1e6) #uJy
         self.img_peak_bounds = np.max(img_data[self.rms_bounds])
         self.img_peak_pos = np.where(img_data == self.img_peak_bounds)
-        self.img_peak_rms = rms_map.data[self.img_peak_pos][0]
+        if len(rms_map.data[self.img_peak_pos])>0:
+            self.img_peak_rms = rms_map.data[self.img_peak_pos][0]
+        else:
+            self.img_peak_rms = 0.
         self.dynamic_range = self.img_peak_bounds/self.img_peak_rms
         self.blends = len(np.where(self.df[self.island_col].value_counts() > 1)[0])
         self.img_flux = np.sum(img_data[~np.isnan(img_data)]) / (1.133*((img.bmaj * img.bmin) / (img.raPS * img.decPS))) #divide by beam area

for the first instance, and

Index: catalogue.py
===================================================================
--- catalogue.py	(revision 48353)
+++ catalogue.py	(working copy)
@@ -336,12 +336,18 @@
         img_data = img.fits.data
         if self.finder == 'aegean':
             img_data = img_data[0][0]
-        self.img_peak = np.max(img_data[~np.isnan(img_data)])
+        if len(img_data)>0:
+            self.img_peak = np.max(img_data[~np.isnan(img_data)])
+        else:
+            self.img_peak = 0.
         self.rms_bounds = rms_map.data > 0
         self.img_rms = int(np.median(rms_map.data[self.rms_bounds])*1e6) #uJy

for the second.

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

No branches or pull requests

1 participant