Skip to content
Snippets Groups Projects
Select Git revision
  • afa8a8de4fcb34600eed4f96139d3922547c2f1d
  • master default protected
  • releases/v0.5.19 protected
  • v0.5.x
  • releases/v0.7.0 protected
  • releases/v0.5.17.tim_survey protected
  • compress_tim_survey_no_metadata_compression
  • juelich_0_5_18
  • releases/v0.6.0.tim_survey protected
  • compress_tim_survey
  • releases/v0.5.18 protected
  • expose_elevation_for_parset
  • releases/v0.5.17 protected
  • releases/v0.6.0 protected
  • releases/v0.5.16 protected
  • releases/v0.5.15 protected
  • nico_testing_juelich
  • nightly_build_test
  • releases/v0.5.14 protected
  • releases/v0.5.13 protected
  • releases/v0.5.12 protected
  • v0.5.19
  • v0.7.0
  • v0.5.17.tim_survey
  • v0.6.0.tim_survey
  • v0.5.18
  • v0.5.17
  • v0.6.0
  • v0.5.16
  • v0.5.15
  • v0.5.14
  • v0.5.13
  • v0.5.12
  • v0.5.11
  • v0.5.10
  • v0.5.9
  • v0.5.8
  • v0.5.7
  • v0.5.6
  • v0.5.5
  • v0.5.4
41 results

aggregate_and_plot.py

Blame
  • user avatar
    Timo Millenaar authored
    afa8a8de
    History
    user avatar afa8a8de
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    aggregate_and_plot.py 1.23 KiB
    #!/usr/bin/env python3
    from lofar_quality.manipulate.common import join_inspect_ds
    from lofar_quality.inspect.inspect_dataset import plot_inspect_ds
    from pathlib import Path
    import logging
    
    FORMAT = '%(levelname)-15s %(asctime)s: %(message)s'
    logging.basicConfig(format=FORMAT, level="INFO")
    
    if __name__ == "__main__":
        h5_paths = []
        with open("inputs.txt", "r") as file:
            for line in file:
                line = str(line.strip()) # remove white space
                path = Path(line)
                if path.exists():
                    if path.suffix.lower() == ".h5":
                        h5_paths.append(line)
                    else:
                        logging.info(f"File exists but is not an h5 file: {line}")
    
                else:
                    logging.info(f"Could not find the following input file: {line}")
            logging.info(f"Found {len(h5_paths)} h5 files")
    
        h5_output_path = "inspect.h5"
        join_inspect_ds(h5_paths, h5_output_path)
        plot_paths = plot_inspect_ds(h5_output_path, "./", min_elevation=15)
    
        with open("outputs.txt", "w") as file:
            file.write(str(Path(h5_output_path).absolute()) + "\n")
            for file_path in plot_paths:
                path = Path(file_path).absolute()
                file.write(str(path) + "\n")