batch 中 loc[:, 0] 索引越界
我在 commissioning 仓库中遇到了如下问题(是一个普遍问题),复现例子如下:
sudo -u#35905 srun -G 1 -c 2 --prefer GPU100+ FSMP/fsmp.py FSMP/sparsify/2283/005.h5 -o FSMP/fsmp/2283/005.pq --ref ser/0_2283.h5 --full PE/2283/005.pq
Traceback (most recent call last):
File "/mnt/stage/liuyq/commission/FSMP/fsmp.py", line 88, in <module>
(flip, s0_history, Δν_history, nu_lc_history, op_history, creations, creations_e) = batch(
^^^^^^
File "/mnt/stage/liuyq/commission/FSMP/analysis/fsmp/batch.py", line 192, in batch
v_lc(tq["q_s"], w_all, loc[:, 0]) )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/stage/liuyq/commission/FSMP/analysis/fsmp/batch.py", line 27, in v_lc
return np.log(q_s[w_all, np.array(loc, dtype=np.uint32)])
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: index 17 is out of bounds for axis 1 with size 17
FSMP/sparsify(fsmp) 均为公共路径 /junofs/production/commissioning/sparsify(fsmp),ser/0_2283.h5 在 /junofs/C/ser/0_2283.h5 中有,FSMP 版本在 master 基础上另手写了 55fbedb5 中的浮点数支持和步数:
diff --git a/analysis/__init__.py b/analysis/__init__.py
index cfa09b2..b37d03a 100644
--- a/analysis/__init__.py
+++ b/analysis/__init__.py
@@ -1 +1 @@
-TRIALS = 5000
+TRIALS = 2000
diff --git a/analysis/fsmp/writer.py b/analysis/fsmp/writer.py
index ec1fa2b..406df5b 100644
--- a/analysis/fsmp/writer.py
+++ b/analysis/fsmp/writer.py
@@ -92,6 +92,8 @@ _type_map = {
np.dtype(np.uint16): pa.uint16(),
np.dtype(np.uint32): pa.uint32(),
np.dtype(np.uint64): pa.uint64(),
+ np.dtype(np.float32): pa.float32(),
+ np.dtype(np.float64): pa.float64(),
}
@@ -37,9 +37,7 @@ waves = reader.waveform
sds = spe_data[np.searchsorted(spe_data["ch"], chs)]
gains = gain_data[np.searchsorted(gain_data["ch"], chs)]
-wave_deconv = multi_deconv(
- waves, sds["Gm"], sds["ser"]
-)
+wave_deconv = multi_deconv(waves, sds["Gm"], sds["ser"], niter=1000)
# number of waveforms
n_wave = len(reader)
@Berrysoft /cc @heroxbd
Edited by lynn