python - 如何添加 auxil.py 模块?
问题描述
我正在尝试使用 Sentinel 1 执行图像分类。我是编码新手,所以我使用这个:http ://mortcanty.github.io/src/s1class.html 我收到一条错误消息:auxil 不是模块所以我想过从 git hub 安装 auxil.py:https://github.com/mortcanty/CRCPython/blob/master/src/auxil/auxil.py
但是有些模块/库已经过时了,所以我不断收到错误,非常感谢任何帮助
解决方案
您可以在自己的代码中定义该存储库中的类和方法,它们将起作用。例如,我需要这个类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
推荐阅读
- java - Spring boot Jsp / Tag在不同模块中
- jquery - Jssor 是否可以在滑块上放置一个暂停按钮并播放?
- spring - Spring Boot 执行器端点未通过 HTTP 公开
- python - 将 Pandas DataFrame 列值与另一个 DataFrame 列匹配
- glsl - Vulkan 是否支持着色器中的原子浮点操作?
- javascript - 无法读取未定义的属性“电子表格” - 谷歌电子表格
- python - 连接具有多个值组件的两个 RDD 并将结果展平
- javascript - MomentJS 获取相对于今天的先前日期
- node.js - 无法在浏览器中连接到我的节点服务器,但 curl 有效
- spring-boot - LocalDateTime 的自定义 spring-kafka 反序列化器