mirror of
https://github.com/vale981/two_qubit_model
synced 2025-03-05 17:51:40 -05:00
support overwriting the hi_key
This commit is contained in:
parent
c9be8c2344
commit
f1cc9833dc
1 changed files with 16 additions and 6 deletions
|
@ -120,15 +120,25 @@ def get_data(
|
||||||
in read-only mode. The ``kwargs`` are passed on to :any:`HIData`.
|
in read-only mode. The ``kwargs`` are passed on to :any:`HIData`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
hash = model.hexhash
|
hexhash = model.hexhash
|
||||||
|
|
||||||
with model_db(data_path) as db:
|
with model_db(data_path) as db:
|
||||||
if hash in db and "data_path" in db[hash]:
|
if hexhash in db and "data_path" in db[hexhash]:
|
||||||
return HIData(
|
path = Path(data_path) / db[hexhash]["data_path"]
|
||||||
Path(data_path) / db[hash]["data_path"], read_only=read_only, **kwargs
|
try:
|
||||||
)
|
return HIData(path, read_only=read_only, **kwargs)
|
||||||
|
except:
|
||||||
|
return HIData(
|
||||||
|
path,
|
||||||
|
hi_key=model.hops_config,
|
||||||
|
read_only=False,
|
||||||
|
check_consistency=False,
|
||||||
|
overwrite_key=True,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"No data found for model with hash '{hash}'.")
|
raise RuntimeError(f"No data found for model with hash '{hexhash}'.")
|
||||||
|
|
||||||
|
|
||||||
def model_data_iterator(
|
def model_data_iterator(
|
||||||
|
|
Loading…
Add table
Reference in a new issue