Skip to content
Snippets Groups Projects
Select Git revision
  • 706f0f28a27c28f05811a0694a65424fc6b8e6df
  • master default protected
  • MAM-110-propagate-output-sasid
  • MAM-109-specify-ingest-location
  • master-backup-september-2024
5 results

serializers.py

Blame
  • 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")