necst-telescope / necst

:gem: NEw Control System for Telescope
https://necst-telescope.github.io/necst/
MIT License
3 stars 0 forks source link

Resolve HEMT and SIS Bias Reader function calling problem #174

Closed TatsumiISHIKAWA closed 1 year ago

TatsumiISHIKAWA commented 1 year ago

Motivation In necst/rx/hemt_bias.py and sis_bias.py, neclib function BiasReader and BiasSetteris called.

In hemt_bias.py,

channels = set(map(lambda x: x[:-4], self.reader_io.Config.channel.keys()))
for id in channels:
   v_drain = self.reader_io.get_voltage(f"{id}_Vdr").to_value("V").item()
   v_gate1 = self.reader_io.get_voltage(f"{id}_Vg1").to_value("V").item()
   v_gate2 = self.reader_io.get_voltage(f"{id}_Vg2").to_value("V").item()

In sis_bias.py,

channels = set(map(lambda x: x[:-2], self.reader_io.Config.channel.keys()))
for id in channels:
     current = self.reader_io.get_current(f"{id}_I").to_value("uA").item()
     voltage = self.reader_io.get_voltage(f"{id}_V").to_value("mV").item()
     power = self.reader_io.get_power(f"{id}_P").to_value("mW").item()

In neclib/defaults/config.toml,

[sis_bias_reader]
_ = "CPZ3177"
rsw_id = 0
ave_num = 100
smpl_freq = 1000
single_diff = "SINGLE"
all_ch_num = 10
ch_range = '5V'
channel = { ch1_Vdr = 1, ch1_Vg1 = 2, ch1_Vg2 = 3, USB_V = 5, LSB_V = 7, USB_I = 6, LSB_I = 8, USB_P = 9, LSB_P = 10 }
converter = [
    {ch = "ch1_Vdr", V = "x"},
    {ch = "ch1_Vg1", V = "x"},
    {ch = "ch1_Vg2", V = "x"},
    {ch = "USB_V", V = "x * 5"},
    {ch = "USB_I", I = "x * 500"},
    {ch = "LSB_V", V = "x * 5"},
    {ch = "LSB_I", I = "x * 500"},
    {ch = "USB_P", P = "x * 6 - 30"},
    {ch = "LSB_P", P = "x * 6 - 30"}
]

[hemt_bias_reader]
_ = "CPZ3177"
rsw_id = 0

Because configs of SIS and HEMT are mixed in config.toml/sis_bias_reader, necst/rx can't call correct target id.

In addition, it is needed to warn the writing format of config.toml in neclib document.

yamatomatsuzuki commented 1 year ago

修正後

# hemt_bias.py

channels = set(map(lambda x: x[:-4], filter(lambda y: "_" in y[:-2], self.reader_io.Config.channel.keys())))
# sis_bias.py

channels = set(map(lambda x: x[:-2], filter(lambda y: "_" not in y[:-2], self.reader_io.Config.channel.keys())))

HEMTでは、channel のkeyの後ろから2文字を消したときに"_"が存在すれば、後ろから4文字を消去、SISではchannelのkeyの後ろから2文字を消したときに"_"が存在しなければ、後ろから2文字を消去するという汎用性の低い判定を行なっています。 そのため、neclib/defaults/config.tomlでは規則を守ってチャンネルリストを書く必要があります。