1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00

never use outdated cache

This commit is contained in:
Lukas Winkler 2023-02-17 16:04:16 +01:00
parent 70d25c3f72
commit f23522b6bd
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -17,7 +17,10 @@ class ParticlesMeta:
def read_file(file: Path) -> Tuple[pd.DataFrame, ParticlesMeta]:
cache_file = file.with_suffix(".cache.pickle")
meta_cache_file = file.with_suffix(".cache_meta.pickle")
if not (cache_file.exists() and meta_cache_file.exists()):
cache_is_outdated = file.stat().st_mtime > cache_file.stat().st_mtime
if cache_is_outdated:
print("cache is outdated")
if not (cache_file.exists() and meta_cache_file.exists()) or cache_is_outdated:
reference_file = h5py.File(file)
has_fof = "FOFGroupIDs" in reference_file["PartType1"]