File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ from datetime import datetime
2+ from functools import lru_cache
3+ from pathlib import Path
14from typing import Literal , Optional
25
36from pydantic import BaseModel
47
8+ from murfey .util .config import get_machine_config
9+
10+
11+ @lru_cache (maxsize = 5 )
12+ def _cryolo_model_path (visit : str , instrument_name : str ) -> Path :
13+ machine_config = get_machine_config (instrument_name = instrument_name )[
14+ instrument_name
15+ ]
16+ if machine_config .model_search_directory :
17+ visit_directory = (
18+ machine_config .rsync_basepath / str (datetime .now ().year ) / visit
19+ )
20+ possible_models = list (
21+ (visit_directory / machine_config .model_search_directory ).glob ("*.h5" )
22+ )
23+ if possible_models :
24+ return sorted (possible_models , key = lambda x : x .stat ().st_ctime )[- 1 ]
25+ return machine_config .default_model
26+
527
628class CLEMAlignAndMergeParameters (BaseModel ):
729 crop_to_n_frames : Optional [int ] = 50
You can’t perform that action at this time.
0 commit comments