Menu

#2134 remaining indexing modes to be implemented

nextrelease
open-accepted
nobody
None
5
2022-08-30
2019-03-26
No

After fixing 1629, it occurred to me that IDL still has an indexing mode which I'd like to pick up:

IDL> lookup= [.1,.2,.3,.4,.5,.4,.3,.2,.1]
IDL> t1= [[3,4,5,6],[4,5,6,7]]
IDL> print, lookup[t1]
0.400000 0.500000 0.400000 0.300000
0.500000 0.400000 0.300000 0.200000

Right now, only rank 1 datasets can be used to index in Autoplot, and it should be possible to work out the logic which supports this case. (There are modes supported here different than IDL or SciPy indexing, such as implicit slicing:vap+inline:ds=rand(20,30)&ds[2:12], which may make this non-trivial.)

I suspect there are other modes needs to complete the set, and this ticket will be closed when they done.

See http://jfaden.net/jenkins/job/autoplot-test037/ws/indexing.jy

Discussion

  • Jeremy Faden

    Jeremy Faden - 2019-03-26
     
  • Jeremy Faden

    Jeremy Faden - 2019-03-26

    Another challenge with this is where a rank 2 list-of-indeces might be confused with a rank 2 array of indeces. For example:

    randomSeed(0)
    ds= randn(40,40)
    r= where( ds.lt(0) )
    print ds[r]   # this is a rank 1 result
    idx1= dataset( [[3,4,5,6],[4,5,6,7]]  )
    print idx1
    print idx1[0]
    print ds[idx1[0]] # is this ds[[3,4],:] or ds[3,4]?
    print ds[idx1[0],idx1[1]] 
    print ds[3,4], ds[idx1[0],idx1[1]][0], ' should be the same'
    print ds[idx1]  # do I mean slices at the rank 2 idx, or are these the two dimension indices as with where?
    
     

    Last edit: Jeremy Faden 2019-04-03
  • Jeremy Faden

    Jeremy Faden - 2019-04-03

    I had a mistake where the writable dataset was checked for dimensionality, and the read-only one (always present) should be used.

     
  • Jeremy Faden

    Jeremy Faden - 2019-04-03
    • status: open --> closed-fixed
     
  • Jeremy Faden

    Jeremy Faden - 2019-04-03
    • status: closed-fixed --> open-accepted
     
  • Jeremy Faden

    Jeremy Faden - 2019-04-03

    The last mode of the example needs to be considered.

     
  • Jeremy Faden

    Jeremy Faden - 2020-01-12

    Here's another bug:

    ds= getDataSet( 'https://jfaden.net/git/jbfaden/public/blob/master/u/jeremy/2020/20200105/Screenshot_20200101.png' )
    print ds[188,192]
    

    This fails because while this should be the same as ds.slice(188).slice(192), the code attempts to use a rank 0 access of a rank 3 dataset, when this should result in rank 1.

     
  • Jeremy Faden

    Jeremy Faden - 2021-10-11

    And it looks like negative stride, used to flip arrays, isn't solidly supported. For example:

    data = indgen(5)
    data = data[::-1]
    for d in data: print d
    

    and

    data = indgen(6,5)
    data = data[:,::-1]
    for d1 in data: 
         for d2 in d1:
              print d2,
         print ' '
    

    Here's the script where I encountered the problem:

    from org.das2.graph.SpectrogramRenderer import RebinnerEnum
    #ds= getDataSet('file:///home/jbf/ct/autoplot/data/sps/shing/180310_1700_2300-Heliotown.sps')
    #ds= ds[0:20]
    
    flip= getParam( 'flip', True, 'Flip the data to show where it does work', [True,False] )
    
    ds= distance( 20,300, 150,150, 25,30 ) + randn(20,300)/10
    ds= link( indgen(20), linspace(30,15,300), ds )
    
    if flip:
        ds= ds[:,::-1]
        #ds= ds[:,linspace(300.,0.,301)]
    plot( ds, renderType='nnSpectrogram' )
    dom.plotElements[0].controller.renderer.rebinner= RebinnerEnum.lanlNearestNeighbor 
    
     

    Last edit: Jeremy Faden 2021-10-18
  • Jeremy Faden

    Jeremy Faden - 2022-08-30

    Ivar and I noticed this bug, where a rank 1 set of indices should be promoted to rank two before assigning the values:

    from java.lang import Double
    ds= randn(20,5)
    r= [1,2,3]
    
    ds[r]= Double.NaN
    plot( ds ) 
    

    This should result in records 1, 2, and 3 being made all NaN, but instead ds[0,1], ds[0,2], ds[0,3] are made fill.

     
  • Jeremy Faden

    Jeremy Faden - 2022-08-30

    That last bug is fixed in 20220830a and v2022a_8.

     
MongoDB Logo MongoDB