The URI of TUHH Docker Registry changed from "docker.rz.tu-harburg.de:5000" to "docker.rz.tu-harburg.de". Please update your gitlab-ci.yml files if you use images from this registry.

Commit dfdf8cdb authored by Hendrik Preuss's avatar Hendrik Preuss

convert output to hdf5 format

parent c7934e33
......@@ -94,27 +94,26 @@ int main(int argc, char *argv[]) {
// light polarization (TE or TM)
Polarization pol = TE;
// printf("# Wavelength: %g\n", lambda);
printf("#Parameters = {");
//printf("# Wavelength: %g; ", lambda);
if (pol == TE) {
printf("# Polarization: TE\n");
printf("polarization=TE; ");
} else if (pol == TM) {
printf("# Polarization: TM\n");
printf("polarization=TM; ");
}
printf("# Layer thicknesses: ");
printf("layer_thicknesses=");
for(unsigned i = 0; i < hx.size(); i++) {
printf("%-9g", hx[i]);
printf("%g,", hx[i]);
}
printf("\n# Refractice indeces: ");
printf("; refractice_indeces=");
for(unsigned i = 0; i < n.size(); i++) {
printf("%-9g", n[i]);
printf("%g", n[i]);
}
// layer names as used in wgdef (length = layers + 2)
printf("\n#\n# %-9s %-11s %-11s %-11s %-11s\n",
"freq [THz]",
"lambda [um]",
"k_0 [1/um]",
"n_eff",
"b_eff [1/um]");
printf("; labels=freq,lambda,k_0,n_eff,b_eff");
printf("; units=THz,um,1/um,,1/um");
printf("}\n");
double lambda;
// For a sweep the following section can be put into a loop.
// The function f_p needs to be adapted to include the sweep parameter.
......
#!/bin/bash
cp apps/$1/$2.cpp source/s.cpp
cd source
make
cd ../
mkdir -p bin/$1
cp source/s bin/$1/$2
bin/$1/$2 > bin/$1/out.txt
python conversion.py bin/$1/out.txt
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os.path
import data_io as dio
import general_functions as gf
def print_help():
print("python conversion.py -h print this help"
"python conversion.py filename labels units")
if __name__ == "__main__":
if len(sys.argv) < 2:
print_help()
elif sys.argv[1] == "-h":
print_help()
else:
filename = sys.argv[1]
labels = []
units = []
if len(sys.argv) >= 3:
labels = sys.argv[2].split(',')
if len(sys.argv) >= 4:
units = sys.argv[3].split(',')
basename, _ = os.path.splitext(filename)
data = dio.read_ascii(filename, labels, units)
if len(sys.argv) > 4:
for i in range(4, len(sys.argv)):
if len(sys.argv) >= i+2:
param_name = sys.argv[i]
param_value = sys.argv[i+1]
if gf.is_number(param_value):
param_value = gf.str2number(param_value)
data[param_name] = param_value
dio.write(basename, data)
Markdown is supported
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