xarray dataset dependency is incorrect when adding an independent parameter to the measurement
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从复现示例中的 Measurement、datasaver.dataset 和 to_xarray_dataset 入口点开始,然后跟踪 ParamSpec 的 depends_on 元数据如何转换为 xarray 变量。使用确定性的 setpoints 复现该示例,并比较 X、Y 和独立 Z 的最终依赖关系。完成的标准是 Y 依赖于 X,而 Z 依赖于索引,并为此案例添加回归覆盖。
由索引模型根据 Issue 内容生成。
描述
I created a parameter with setpoints Y which depends on setpoint X.
Then I created another parameter Z which is independent from the other two.
I measured Y and Z in the measurement context, then convert the result dataset to an xarray.
Expected behaviour
I expect that the Y would be a data variable that depends on X, and Z on index, as inferred from the paramspecs.
{'foo_instrument_X': ParamSpec('foo_instrument_X', 'array', 'X', '', inferred_from=[], depends_on=[]),
'foo_instrument_Y': ParamSpec('foo_instrument_Y', 'array', 'Y', '', inferred_from=[], depends_on=['foo_instrument_X']),
'foo_instrument_Z': ParamSpec('foo_instrument_Z', 'numeric', 'Z', '', inferred_from=[], depends_on=[])}
Actual behaviour
All parameters became data variables that depended on index.
Steps to reproduce
Run the following snippet
import numpy as np
import qcodes as qc
from qcodes import Measurement
from qcodes.instrument import Instrument
from qcodes.parameters import Parameter, ParameterWithSetpoints
from qcodes.validators import Arrays, Numbers
class FooGeneratedSetpoints(Parameter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def get_raw(self):
return np.array(range(4,8))
class FooArray(ParameterWithSetpoints):
def get_raw(self):
return np.array(range(4))
class FooInstrument(Instrument):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.add_parameter(
"X",
parameter_class=FooGeneratedSetpoints,
vals=Arrays(shape=(4,))
)
self.add_parameter(
"Y",
parameter_class=FooArray,
setpoints=(self.X,),
vals=Arrays(shape=(4,))
)
foo = FooInstrument("foo_instrument")
foo.add_parameter("Z", set_cmd=None)
meas = Measurement()
meas.register_parameter(foo.Y)
meas.register_parameter(foo.Z)
with meas.run() as datasaver:
for z in range(8,12):
datasaver.add_result(
(foo.Y, foo.Y()), (foo.Z, z)
)
dataset = datasaver.dataset
dataset.to_xarray_dataset()
If I modify the setpoint to the following, the issue disappeared and the result dataset is as expected.
from random import random
class FooGeneratedSetpoints(Parameter):
...
def get_raw(self):
return np.array([random() + i for i in range(4,8)])
...
- 主要语言
- Python
- 星标
- 464
- 派生
- 364
- 平均合并
- 16 小时 20 分钟
- 30 天内合并 PR
- 100
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/Qcodes 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
microsoft/Qcodes#1087 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
维护者通常 1 天内回复
-
Export to xarray dataset fails when two data variables do not share same setpoints可能重新可做 @jenshnielsen 于 115 天前认领,目前没有进行中的 PR。 未关闭
microsoft/Qcodes#8232 · 1 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 20/100
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
Graphify-Labs/graphify#4524 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
topoteretes/cognee#5982 ·
维护者通常 1 天内回复
-
Patches of derivations with `__structuredAttrs` are ignored可能已有人在做 @KiaraGrouwstra 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 81/100
nix-community/vulnix#184 ·
-
New Internship未关闭new_internship
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 64/100
aws-samples/sample-per-model-bedrock#295 ·
维护者通常 1 天内回复