hall_probe.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Auspex 作者: BBN-Q 项目源码 文件源码
def __init__(self, calibration_file, supply_voltage_method, readout_voltage_method):
        super(HallProbe, self).__init__()
        self.name = "Lakeshore Hall Probe"
        with open(calibration_file) as cf:
            lines = [l for l in cf.readlines() if l[0] != '#']
            if len(lines) != 2:
                raise Exception("Invalid Hall probe calibration file, must contain two lines.")
            try:
                self.output_voltage = float(lines[0])
            except:
                raise TypeError("Could not convert output voltage to floating point value.")
            try:
                poly_coeffs = np.array(lines[1].split(), dtype=np.float)
                self.field_vs_voltage = np.poly1d(poly_coeffs)
            except:
                raise TypeError("Could not convert calibration coefficients into list of floats")
        self.getter = readout_voltage_method
        self.setter = supply_voltage_method

        self.setter(self.output_voltage)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号