File tree Expand file tree Collapse file tree
src/murfey/client/contexts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,24 +36,26 @@ def _find_reference(txrm_file: Path) -> Path | None:
3636 )
3737 candidates .sort (key = lambda x : x .timestamp , reverse = True )
3838 for ref_option in candidates :
39- mosaic_size = 1
40- with OleFileIO (ref_option .full_path ) as xrm_ole :
41- # Find images which are not mosaics (txrm spec typos this as mosiac)
42- if xrm_ole .exists ("ImageInfo/MosiacRows" ) and xrm_ole .exists (
43- "ImageInfo/MosiacColumns"
44- ):
45- mosaic_size = int (
46- np .frombuffer (
47- xrm_ole .openstream ("ImageInfo/MosiacRows" ).getvalue (), np .int32
48- )[0 ]
49- * np .frombuffer (
50- xrm_ole .openstream ("ImageInfo/MosiacColumns" ).getvalue (),
51- np .int32 ,
52- )[0 ]
53- )
54- if mosaic_size == 0 :
55- logger .info (f"Found reference { ref_option .name } " )
56- return Path (ref_option .full_path )
39+ if "ref" in ref_option .name .lower ():
40+ mosaic_size = 1
41+ with OleFileIO (ref_option .full_path ) as xrm_ole :
42+ # Find images which are not mosaics (txrm spec typos this as mosiac)
43+ if xrm_ole .exists ("ImageInfo/MosiacRows" ) and xrm_ole .exists (
44+ "ImageInfo/MosiacColumns"
45+ ):
46+ mosaic_size = int (
47+ np .frombuffer (
48+ xrm_ole .openstream ("ImageInfo/MosiacRows" ).getvalue (),
49+ np .int32 ,
50+ )[0 ]
51+ * np .frombuffer (
52+ xrm_ole .openstream ("ImageInfo/MosiacColumns" ).getvalue (),
53+ np .int32 ,
54+ )[0 ]
55+ )
56+ if mosaic_size == 0 :
57+ logger .info (f"Found reference { ref_option .name } " )
58+ return Path (ref_option .full_path )
5759 logger .warning (f"No reference found for { txrm_file } " )
5860 return None
5961
You can’t perform that action at this time.
0 commit comments