Skip to content

Schlum1 quadrupoles fixed

  • Concern : API
  • Platform : macOS/Linux/Windows
  • Problem Description : I was testing the Resipy doing schlum1 quadrupoles combinations. then i tryed to do my own "handmade" combination and shows this difference: MicrosoftTeams-image So i tryed to understand what was missing in excel (the red lines is the one that is missing (A,M,N,B)): excel so i identify that is a math problem in the variables 'M' and 'B', when it multiplies even numbers with odd numbers never get the odd results on spacing n.

then we know that n cannot be higher then a.

  • How to reproduce it : Run Schlum1 without the following fix

`def schlum1(elec_num, a, n): ''' Generates quadrupole matrix for Schlumberger survey.

Parameters
----------
elec_num : int
    Number of electrodes
a : int or list of int
    Spacing between electrodes (in electrode spacing).
n : int or list of int
    Quadrupole seperation in electrode spacing.    '''
elec_id = np.arange(elec_num)+1
proto_mtrx = pd.DataFrame([])
if isinstance(a, list) is False:  
    n_ = np.array(range(0,n))+1
    for j in np.array(range(0,len(n_))):
        if n_[j] >= a:
            #print(n_[j],a)
            A = elec_id
            M = A + n_[j]
            N = M + a
            B = N + n_[j]
            # if j == 0:
            #     proto_mtrx = pd.DataFrame(np.column_stack((A, B, M, N)))
            # if j > 0:
            new_rows = pd.DataFrame(np.column_stack((A, B, M, N)))
            proto_mtrx = proto_mtrx.append(new_rows)
       # else:
           # proto_mtrx = proto_mtrx[proto_mtrx.iloc[:,1] <= elec_num]
          
else:
    for i in np.array(range(0,len(a))):
        n_ = np.array(range(0,n[i]))+1
        for j in np.array(range(0,len(n_))):
            if n_[j] >= a[i]:
                A = elec_id
                M = A + n_[j]
                N = M + a[i]
                B = N + n_[j]
            # if (i + j) == 0:
            #     proto_mtrx = pd.DataFrame(np.column_stack((A, B, M, N)))
            # if (i + j) > 0:
                new_rows = pd.DataFrame(np.column_stack((A, B, M, N)))
                proto_mtrx = proto_mtrx.append(new_rows)

proto_mtrx = proto_mtrx[proto_mtrx.iloc[:,1] <= elec_num]
return(proto_mtrx)`
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information