Unverified Commit 3a8c5691 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Make filename argument

parent 4b907b7c
......@@ -12,6 +12,7 @@ import time
import matplotlib.pyplot as plt
import datetime
import sys
import os.path
import zmq
import struct
import pandas as pd
......@@ -72,7 +73,7 @@ file_cal_times = []
file_caldata = []
starttime = Time.now() + 2 * u.hour
if len(sys.argv) > 1:
if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]):
df = pd.read_csv(sys.argv[1], parse_dates=[0])
is_data = (df["tracker"] == 'suntracker') & \
(df["offset az (deg)"] < 0.01) & \
......@@ -96,10 +97,16 @@ if starttime < eclipse_endtime < starttime + 3*u.hour:
ax.axvline(eclipse_endtime.datetime, linestyle='--', linewidth=1, color='lightgrey')
ax.text(eclipse_endtime.datetime,0.1,'Einde: '+eclipse_endtime.isot[11:16],rotation=90, color='black', transform=ax.get_xaxis_transform())
if len(sys.argv) == 1:
datafile = open(f"data{int(Time.now().unix)}.txt", "w")
if len(sys.argv) == 1 or not(os.path.isfile(sys.argv[1])):
# Create new file
if len(sys.argv) == 1:
datafilename = f"data{int(Time.now().unix)}.txt"
else:
datafilename = sys.argv[1]
datafile = open(datafilename, "w")
print("time (UTC),tracker,offset az (deg),offset el (deg),azimuth from north (deg),elevation (deg),signal", file=datafile)
else:
# Append to existing file
datafile = open(f"{sys.argv[1]}", "a")
while True:
......
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