From c83bef0dff739d51c774224960457b0db09f6ca1 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Fri, 3 Feb 2023 16:22:08 +0100 Subject: [PATCH] ZH: setup structure to run various setups of parameters --- .../airshower_beacon_simulation/Makefile | 2 +- .../matrix_base/base | 1 + .../matrix_base/make_matrix.py | 32 +++++++++++++++++++ .../matrix_base/run_matrix.sh | 28 ++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 120000 simulations/airshower_beacon_simulation/matrix_base/base create mode 100755 simulations/airshower_beacon_simulation/matrix_base/make_matrix.py create mode 100755 simulations/airshower_beacon_simulation/matrix_base/run_matrix.sh diff --git a/simulations/airshower_beacon_simulation/Makefile b/simulations/airshower_beacon_simulation/Makefile index c74642f..6ab7b77 100644 --- a/simulations/airshower_beacon_simulation/Makefile +++ b/simulations/airshower_beacon_simulation/Makefile @@ -1,6 +1,6 @@ .PHONY: all -FIG_DIR := ./figures +FIG_DIR ?= ./figures -include config.mk diff --git a/simulations/airshower_beacon_simulation/matrix_base/base b/simulations/airshower_beacon_simulation/matrix_base/base new file mode 120000 index 0000000..8681f8b --- /dev/null +++ b/simulations/airshower_beacon_simulation/matrix_base/base @@ -0,0 +1 @@ +base \ No newline at end of file diff --git a/simulations/airshower_beacon_simulation/matrix_base/make_matrix.py b/simulations/airshower_beacon_simulation/matrix_base/make_matrix.py new file mode 100755 index 0000000..5f7d3fc --- /dev/null +++ b/simulations/airshower_beacon_simulation/matrix_base/make_matrix.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import os +import os.path as path +from itertools import product + +baselines = [ '', 72 ] +noise_sigmas = [ 0, '1e4' ] +clock_devs = [0, 20] +trace_lengths = [ 4096 ]#, 16384 ] + +for options in product(baselines, clock_devs, noise_sigmas, trace_lengths): + baseline, clk_dev, noise, trace = options + + dirname = f"matrix_c{clk_dev}_b{baseline}_N{trace}_noise{noise}" + print(dirname) + + # Make directory + if path.exists(dirname): + print(f"{dirname} already exists! continuing..") + + os.makedirs(dirname, exist_ok=True) + + # Setup config.mk + with open(path.join(dirname, 'env.sh'), 'w') as fp: + template = f""" +export CLK_DEV={clk_dev} +export REF_ANTS={baseline} +export NOISE_SIGMA={noise} +export TRACE_N={trace} +""" + fp.write(template) diff --git a/simulations/airshower_beacon_simulation/matrix_base/run_matrix.sh b/simulations/airshower_beacon_simulation/matrix_base/run_matrix.sh new file mode 100755 index 0000000..5851493 --- /dev/null +++ b/simulations/airshower_beacon_simulation/matrix_base/run_matrix.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +MATRIXDIR='/scratch/etdeboone/matrix' +MATRIX_ELS="${@:-$MATRIXDIR/matrix*/}" + +BASE=$(realpath ../base) +MAKE="make -C ${BASE} " + +for d in "$MATRIX_ELS" ; +do + echo "Entering $d" + pushd "$d"; + + # Source constants + . env.sh + export FIG_DIR=$(realpath "./figures") + export DATA_DIR=$(realpath "./data") + + mkdir -p $FIG_DIR $DATA_DIR + + $MAKE beacon; + $MAKE clocks; + $MAKE phases; + $MAKE findks; + #$MAKE reconstruct; + echo "Popping" + popd +done