Commit bcd18305 authored by Laurent Petre's avatar Laurent Petre
Browse files

Merge branch 'feature/gbt-configuration' into 'main'

Create the script producing GBT configuration

See merge request !17
parents 8e2c4acc c78c081a
Pipeline #2978157 passed with stages
in 5 minutes and 27 seconds
"""GBT phase scan routines"""
import os
import pandas as pd
def create_configuration(input_filenames, output_directory):
def write_configuration(df):
"""Write the configuration file for a given OptoHybrid"""
fed = df.iloc[0]["fed"]
slot = df.iloc[0]["slot"]
oh = df.iloc[0]["oh"]
output_filename = "{}/fed{}-slot{}/config-oh{}-gbt.cfg".format(
output_directory, fed, slot, oh
os.makedirs(os.path.dirname(output_filename), exist_ok=True)
output_filename, sep=" ", index=False, header=False, columns=["config-name", "phase"]
df = pd.concat((pd.read_csv(f, sep=";") for f in input_filenames), ignore_index=True)
# Create a new column with the configuration name
df["config-name"] = "PHASE_VFAT" + df["vfat"].astype(str)
# Create one file per OptoHybrid
groups = df.groupby(["fed", "slot", "oh"])
"""Main CLI interface"""
import argparse
import pathlib
from gemos.analysis import gbt_phase_scan
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(required=True, dest="command")
# "create-config" command
configuration_parser = subparsers.add_parser("create-config")
configuration_subparsers = configuration_parser.add_subparsers(required=True, dest="subcommand")
# "create-config gbt" subcommand
parser_gbt = configuration_subparsers.add_parser("gbt")
help="Files containing the optimal GBT phases",
help="Output directory in which to store the GBT configuration files",
func=lambda args: gbt_phase_scan.create_configuration(args.inputfiles, args.outputdir)
# Parse the command line
args = parser.parse_args()
......@@ -44,6 +44,9 @@ sphinx-rtd-theme = "^0.5.2"
gem-unpack = "gdh.unpacker:main"
gemos = "gemos.cli:main"
# Legacy interface
gem-sbit-rate-analyze = "gemos.analysis.sbit_rate:main"
gem-dac-scan-fit = "gemos.analysis.dac_scan:fit"
gem-dac-scan-plot = "gemos.analysis.dac_scan:plot"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment