How can i add the auxil.py module?

179 Views Asked by At

I am trying to perform image classification using Sentinel 1. I am new to coding so I am using this: http://mortcanty.github.io/src/s1class.html I got an error saying: auxil is not a module so I thought of installing auxil.py from git hub: https://github.com/mortcanty/CRCPython/blob/master/src/auxil/auxil.py

but some modules/libraries are outdated so I keep getting errors any help is much appreciated

2

There are 2 best solutions below

0
On BEST ANSWER

It appears the repository you linked is using python 2.7. Are you using python 2 or python 3? Python 2 is no longer being supported (as of 1/1/2020). But, you can still use it--it's just not advised.

0
On

You could just define the classes and methods from that repository inside your own code and they will work. For instance, I needed the class Cpm:

class Cpm(object):
'''Provisional means algorithm'''
def __init__(self,N):
    self.mn = np.zeros(N)
    self.cov = np.zeros((N,N))
    self.sw = 0.0000001

def update(self,Xs,Ws=None):
    n,N = np.shape(Xs)
    if Ws is None:
        Ws = np.ones(n)
    sw = ctypes.c_double(self.sw)
    mn = self.mn
    cov = self.cov
    provmeans(Xs,Ws,N,n,ctypes.byref(sw),mn,cov)
    self.sw = sw.value
    self.mn = mn
    self.cov = cov

def covariance(self):
    c = np.mat(self.cov/(self.sw-1.0))
    d = np.diag(np.diag(c))
    return c + c.T - d

def means(self):
    return self.mn