Skip to content

Commit 0afde59

Browse files
Add migration rules for Pyra 4.1.4
1 parent 75ca58f commit 0afde59

File tree

4 files changed

+106
-1
lines changed

4 files changed

+106
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyra-setup-tool"
3-
version = "4.1.3"
3+
version = "4.1.4"
44
description = "manage your Pyra installations"
55
authors = [{ name = "Moritz Makowski", email = "moritz.makowski@tum.de" }]
66
dependencies = ["colorama==0.4.6"]

src/tasks/migrate_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def _migrate_a_single_config_object(
9292
Version("v4.1.0"): Version("v4.1.1"),
9393
Version("v4.1.1"): Version("v4.1.2"),
9494
Version("v4.1.2"): Version("v4.1.3"),
95+
Version("v4.1.3"): Version("v4.1.4"),
9596
}[from_version]
9697
except KeyError:
9798
raise Exception(f'Unknown version "{from_version.as_str()}"')
@@ -186,6 +187,9 @@ def _migrate_a_single_config_object(
186187
if to_version == Version("v4.1.3"):
187188
if "upload" in to_dict.keys():
188189
to_dict["upload"]["only_upload_when_not_measuring"] = True
190+
191+
if to_version == Version("v4.1.4"):
192+
pass
189193

190194
# add future migration rules here
191195

tests/configs/pyra-config-4.1.4.json

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"general": {
3+
"version": "4.1.4",
4+
"seconds_per_core_interval": 30,
5+
"test_mode": false,
6+
"station_id": "...",
7+
"min_sun_elevation": 11
8+
},
9+
"opus": {
10+
"em27_ip": "10.10.0.1",
11+
"executable_path": "C:\\Program Files (x86)\\Bruker\\OPUS_7.8.44\\opus.exe",
12+
"experiment_path": "C:\\Users\\Public\\Documents\\Bruker\\OPUS_7.8.44\\XPM\\experiment.xpm",
13+
"macro_path": "C:\\Users\\Public\\Documents\\Bruker\\OPUS_7.8.44\\Macro\\macro.mtx",
14+
"username": "Default",
15+
"password": "..."
16+
},
17+
"camtracker": {
18+
"config_path": "C:\\Users\\Public\\Documents\\Bruker\\camtracker_3_9_1_0\\CamTrackerConfig.txt",
19+
"executable_path": "C:\\Users\\Public\\Documents\\Bruker\\camtracker_3_9_1_0\\CamTracker_3_9.exe",
20+
"learn_az_elev_path": "C:\\Users\\Public\\Documents\\Bruker\\camtracker_3_9_1_0\\LEARN_Az_Elev.dat",
21+
"sun_intensity_path": "C:\\Users\\Public\\Documents\\Bruker\\camtracker_3_9_1_0\\SunIntensity.dat",
22+
"motor_offset_threshold": 10,
23+
"restart_if_logs_are_too_old": false,
24+
"restart_if_cover_remains_closed": false
25+
},
26+
"error_email": {
27+
"smtp_host": "smtp.gmail.com",
28+
"smtp_port": 587,
29+
"smtp_username": "technical-user@domain.com",
30+
"smtp_password": "...",
31+
"sender_address": "technical-user@domain.com",
32+
"notify_recipients": true,
33+
"recipients": "your@mail.com"
34+
},
35+
"measurement_decision": {
36+
"mode": "automatic",
37+
"manual_decision_result": false,
38+
"cli_decision_result": false
39+
},
40+
"measurement_triggers": {
41+
"consider_time": true,
42+
"consider_sun_elevation": true,
43+
"consider_helios": false,
44+
"start_time": {
45+
"hour": 7,
46+
"minute": 0,
47+
"second": 0
48+
},
49+
"stop_time": {
50+
"hour": 21,
51+
"minute": 0,
52+
"second": 0
53+
},
54+
"min_sun_elevation": 0
55+
},
56+
"tum_plc": {
57+
"ip": "10.0.0.4",
58+
"version": 1,
59+
"controlled_by_user": false
60+
},
61+
"helios": {
62+
"camera_id": 0,
63+
"evaluation_size": 15,
64+
"seconds_per_interval": 6,
65+
"min_seconds_between_state_changes": 180,
66+
"edge_pixel_threshold": 1,
67+
"edge_color_threshold": 40,
68+
"target_pixel_brightness": 50,
69+
"save_images_to_archive": false,
70+
"save_current_image": false
71+
},
72+
"upload": {
73+
"host": "1.2.3.4",
74+
"user": "...",
75+
"password": "...",
76+
"only_upload_at_night": true,
77+
"only_upload_when_not_measuring": true,
78+
"streams": [
79+
{
80+
"is_active": false,
81+
"label": "interferograms",
82+
"variant": "directories",
83+
"dated_regex": "^%Y%m%d$",
84+
"src_directory": "...",
85+
"dst_directory": "...",
86+
"remove_src_after_upload": false
87+
},
88+
{
89+
"is_active": false,
90+
"label": "datalogger",
91+
"variant": "files",
92+
"dated_regex": "^datalogger-%Y-%m-%d*$",
93+
"src_directory": "...",
94+
"dst_directory": "...",
95+
"remove_src_after_upload": false
96+
}
97+
]
98+
}
99+
}

tests/test_migration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_migration() -> None:
1313
Version("4.1.1"),
1414
Version("4.1.2"),
1515
Version("4.1.3"),
16+
Version("4.1.4"),
1617
]:
1718
src_config = tum_esm_utils.files.load_json_file(
1819
tum_esm_utils.files.rel_to_abs_path(
@@ -28,6 +29,7 @@ def test_migration() -> None:
2829
Version("4.1.1"),
2930
Version("4.1.2"),
3031
Version("4.1.3"),
32+
Version("4.1.4"),
3133
]:
3234
if to_version <= from_version:
3335
continue

0 commit comments

Comments
 (0)