Compare commits

..

3 commits

Author SHA1 Message Date
52f6b0f53c
silence readers
Some checks failed
Pytest / pytest (3.13) (push) Failing after 2s
Ruff / ruff (push) Failing after 2s
Mypy / mypy (push) Failing after 17s
Pytest / pytest (3.12) (push) Failing after 2s
Pytest / pytest (3.14) (push) Failing after 2s
2026-03-20 13:00:30 +01:00
96731baeb9
fix when files are unlocked or saved 2026-03-20 12:59:04 +01:00
a9cc2b3f48
fix write measurement call and reporting to user 2026-03-20 12:57:48 +01:00
3 changed files with 15 additions and 11 deletions

View file

@ -320,10 +320,10 @@ def read_data(path: str, project: str, dir_in_project: str, prefix: str, param:
if not param['crr'] == []:
if names is not None:
data_crr = pe.input.sfcf.read_sfcf_multi(directory, prefix, param['crr'], param['mrr'], corr_type_list, range(len(param['wf_offsets'])),
range(len(param['wf_basis'])), range(len(param['wf_basis'])), version, cfg_seperator, keyed_out=True, names=names)
range(len(param['wf_basis'])), range(len(param['wf_basis'])), version, cfg_seperator, keyed_out=True, silent=True, names=names)
else:
data_crr = pe.input.sfcf.read_sfcf_multi(directory, prefix, param['crr'], param['mrr'], corr_type_list, range(len(param['wf_offsets'])),
range(len(param['wf_basis'])), range(len(param['wf_basis'])), version, cfg_seperator, keyed_out=True)
range(len(param['wf_basis'])), range(len(param['wf_basis'])), version, cfg_seperator, keyed_out=True, silent=True)
for key in data_crr.keys():
data[key] = data_crr[key]

View file

@ -34,22 +34,28 @@ def write_measurement(path: str, ensemble: str, measurement: dict[str, dict[str,
"""
db_file = get_db_file(path)
db = os.path.join(path, db_file)
files_to_save = []
get(path, db_file)
unlock(path, db_file)
files_to_save.append(db_file)
conn = sqlite3.connect(db)
c = conn.cursor()
files = []
for corr in measurement.keys():
file_in_archive = os.path.join('.', 'archive', ensemble, corr, uuid + '.json.gz')
file = os.path.join(path, file_in_archive)
files.append(file)
known_meas = {}
if not os.path.exists(os.path.join(path, '.', 'archive', ensemble, corr)):
os.makedirs(os.path.join(path, '.', 'archive', ensemble, corr))
files_to_save.append(file_in_archive)
else:
if os.path.exists(file):
unlock(path, file_in_archive)
known_meas = pj.load_json_dict(file)
if file not in files_to_save:
unlock(path, file_in_archive)
files_to_save.append(file_in_archive)
known_meas = pj.load_json_dict(file, verbose=False)
if code == "sfcf":
parameters = sfcf.read_param(path, uuid, parameter_file)
pars = {}
@ -98,9 +104,8 @@ def write_measurement(path: str, ensemble: str, measurement: dict[str, dict[str,
(corr, ensemble, code, meas_path, uuid, pars[subkey], parameter_file))
conn.commit()
pj.dump_dict_to_json(known_meas, file)
files.append(os.path.join(path, db_file))
conn.close()
save(path, message="Add measurements to database", files=files)
save(path, message="Add measurements to database", files=files_to_save)
return

View file

@ -189,7 +189,6 @@ def import_toml(path: str, file: str, copy_file: bool=True) -> None:
measurement = sfcf.read_data(path, uuid, md['path'], md['prefix'], param,
version=md['version'], cfg_seperator=md['cfg_seperator'], sep='/')
print(mname + " imported.")
elif project['code'] == 'openQCD':
if md['measurement'] == 'ms1':
param = openQCD.read_ms1_param(path, uuid, md['param_file'])
@ -211,8 +210,8 @@ def import_toml(path: str, file: str, copy_file: bool=True) -> None:
param['type'] = 't1'
measurement = openQCD.extract_t1(path, uuid, md['path'], param, str(md["prefix"]), int(md["dtr_read"]), int(md["xmin"]), int(md["spatial_extent"]),
fit_range=int(md.get('fit_range', 5)), postfix=str(md.get('postfix', '')), names=md.get('names', []), files=md.get('files', []))
write_measurement(path, ensemble, measurement, uuid, project['code'], (md['param_file'] if 'param_file' in md else ''))
write_measurement(path, ensemble, measurement, uuid, project['code'], (md['param_file'] if 'param_file' in md else None))
print(mname + " imported.")
if not os.path.exists(os.path.join(path, "toml_imports", uuid)):
os.makedirs(os.path.join(path, "toml_imports", uuid))