feat(ingest): compute shape from the written .h5 in all save paths
This commit is contained in:
@@ -41,6 +41,7 @@ from minimateplus.blastware_file import blastware_filename, write_blastware_file
|
||||
from minimateplus.framing import S3Frame
|
||||
from minimateplus.models import Event
|
||||
from sfm import event_hdf5
|
||||
from sfm.shape_metrics import shape_from_h5
|
||||
|
||||
log = logging.getLogger("sfm.waveform_store")
|
||||
|
||||
@@ -262,6 +263,13 @@ class WaveformStore:
|
||||
serial, filename, filesize, len(a5_frames),
|
||||
hdf5_filename or "(skipped)", sidecar_path.name,
|
||||
)
|
||||
_shape = shape_from_h5(hdf5_path) if hdf5_filename else None
|
||||
_shape_rec = {
|
||||
"shape_crest_factor": _shape["crest_factor"],
|
||||
"shape_near_peak_count": _shape["near_peak_count"],
|
||||
"shape_sample_count": _shape["sample_count"],
|
||||
"shape_axis": _shape["axis"],
|
||||
} if _shape else {}
|
||||
return {
|
||||
"filename": filename,
|
||||
"filesize": filesize,
|
||||
@@ -269,6 +277,7 @@ class WaveformStore:
|
||||
"a5_pickle_filename": a5_path.name,
|
||||
"hdf5_filename": hdf5_filename,
|
||||
"sidecar_filename": sidecar_path.name,
|
||||
**_shape_rec,
|
||||
}
|
||||
|
||||
def save_imported_bw(
|
||||
@@ -445,6 +454,13 @@ class WaveformStore:
|
||||
"h5=%s (no .a5.pkl — A5 source unavailable for BW-imported files)",
|
||||
serial, filename, filesize, hdf5_filename or "(skipped)",
|
||||
)
|
||||
_shape = shape_from_h5(hdf5_path) if hdf5_filename else None
|
||||
_shape_rec = {
|
||||
"shape_crest_factor": _shape["crest_factor"],
|
||||
"shape_near_peak_count": _shape["near_peak_count"],
|
||||
"shape_sample_count": _shape["sample_count"],
|
||||
"shape_axis": _shape["axis"],
|
||||
} if _shape else {}
|
||||
return ev, {
|
||||
"filename": filename,
|
||||
"filesize": filesize,
|
||||
@@ -453,6 +469,7 @@ class WaveformStore:
|
||||
"hdf5_filename": hdf5_filename,
|
||||
"sidecar_filename": sidecar_path.name,
|
||||
"serial": serial,
|
||||
**_shape_rec,
|
||||
}
|
||||
|
||||
def save_imported_idf(
|
||||
@@ -727,6 +744,13 @@ class WaveformStore:
|
||||
hdf5_filename or "(skipped)",
|
||||
len(idf_intervals) if idf_intervals else 0,
|
||||
)
|
||||
_shape = shape_from_h5(hdf5_path) if hdf5_filename else None
|
||||
_shape_rec = {
|
||||
"shape_crest_factor": _shape["crest_factor"],
|
||||
"shape_near_peak_count": _shape["near_peak_count"],
|
||||
"shape_sample_count": _shape["sample_count"],
|
||||
"shape_axis": _shape["axis"],
|
||||
} if _shape else {}
|
||||
return ev, {
|
||||
"filename": filename,
|
||||
"filesize": filesize,
|
||||
@@ -735,6 +759,7 @@ class WaveformStore:
|
||||
"hdf5_filename": hdf5_filename,
|
||||
"sidecar_filename": sidecar_path.name,
|
||||
"serial": serial,
|
||||
**_shape_rec,
|
||||
}
|
||||
|
||||
def load_a5(self, serial: str, filename: str) -> Optional[list[S3Frame]]:
|
||||
|
||||
Reference in New Issue
Block a user