Project

General

Profile

Bug #3902

AllocateFibers bug

Added by Ben Hambrecht over 6 years ago. Updated over 6 years ago.

Status:
Assigned
Priority:
Urgent
Assignee:
Start date:
05/17/2013
Due date:
% Done:

0%

Estimated time:
Duration:

Description

There is an index overflow error due to a confusion between the set of all galaxies and the set of survey selected galaxies, Of which set is all_gals.fiber_ID supposed to contain the fiber_ids? The code below suggests all galaxies, but it contains only the subset.

I included the print statements for debugging.

Code (l. 180 in AllocateFibers_Forero-Romero/AllocateFibers.py):

    # fiber id
    try:
        print "fiber_selection_flag:", fiber_selection_flag.shape, fiber_selection_flag
        check_fiber_sel = np.where( fiber_selection_flag  == True)[0]
        print "check_fiber_sel:", check_fiber_sel.shape, check_fiber_sel
        print "all_gals.fiber_ID:", all_gals.fiber_ID.shape, all_gals.fiber_ID
        fiber_id_sub = all_gals.fiber_ID[check_fiber_sel]
        print "fiber_id_sub:", fiber_id_sub.shape, fiber_id_sub

Output:

fiber_selection_flag: (92,) [False False  True  True False  True  True  True  True False  True False
 False  True  True False False  True False False  True False False False
  True False  True False  True False  True  True False False False False
  True  True False False False False False  True False False False False
 False False  True False  True  True False False  True False False False
  True False  True False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False]
check_fiber_sel: (25,) [ 2  3  5  6  7  8 10 13 14 17 20 24 26 28 30 31 36 37 43 50 52 53 56 60 62]
all_gals.fiber_ID: (25,) [  448.  2348.   252.    34.    31.   718.   654.   452.   317.   380.
   528.  2208.  2483.  2206.   521.   651.   581.   648.  2140.   247.
   180.   515.   588.  2280.    33.]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    176             else:
    177                 filename = fname
--> 178             __builtin__.execfile(filename, *where)

/Users/ben/Documents/DESpec/repo/despec/03-AllocateFibers/AllocateFibers_Forero-Romero/AllocateFibers.py in <module>()
    215 # =====================================================
    216 if __name__ == '__main__':
--> 217         main()
    218 
    219 

/Users/ben/Documents/DESpec/repo/despec/03-AllocateFibers/AllocateFibers_Forero-Romero/AllocateFibers.py in main()
    181                 print "check_fiber_sel:", check_fiber_sel.shape, check_fiber_sel
    182                 print "all_gals.fiber_ID:", all_gals.fiber_ID.shape, all_gals.fiber_ID
--> 183                 fiber_id_sub = all_gals.fiber_ID[check_fiber_sel]
    184                 print "fiber_id_sub:", fiber_id_sub.shape, fiber_id_sub
    185                 print 'a'

IndexError: index 26 is out of bounds for size 25

History

#1 Updated by Ben Hambrecht over 6 years ago

It looks as if I've managed to fix it. Can you please check my changes?

#2 Updated by Jaime Forero over 6 years ago

Hi Ben. I am reading the updated version of AllocateFibers.py and there is only one notable difference I can see: in line 201 you now define fiber_id_sub = all_gals.fiber_ID instead of fiber_id_sub = all_gals.fiber_ID[check_fiber_sel]. Am I missing something?

Another question: what data set was used to generate the bug?



Also available in: Atom PDF