Skip to content

Commit

Permalink
TST: Update sensor coordinates in documentation and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed May 31, 2023
1 parent 74f952e commit 1a2d373
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 266 deletions.
3 changes: 2 additions & 1 deletion cloud_functions/big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def add_sensor_data(self, data, node_id, configuration_id, installation_referenc
batches = [rows[i : i + INSERT_BATCH_SIZE] for i in range(0, len(rows), INSERT_BATCH_SIZE)]
for batch in batches:
errors = self.client.insert_rows(
table=self.client.get_table(self.table_names["sensor_data"]), rows=batch
table=self.client.get_table(self.table_names["sensor_data"]),
rows=batch,
)

if errors:
Expand Down
2 changes: 1 addition & 1 deletion data_gateway/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class NodeConfiguration:
:param dict|None samples_per_packet: A map for each sensor, giving the number of samples sent in a packet from that sensor
:param dict|None sensor_commands:
:param dict|None sensor_conversion_constants:
:param dict sensor_coordinates:
:param dict sensor_coordinates: a mapping of sensor name to sensor coordinates reference
:param list|None sensor_names: List of sensors present on the measurement node
:param dict|None sleep_state:
:return None:
Expand Down
138 changes: 7 additions & 131 deletions docs/source/usage/configuration_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,136 +176,13 @@ Here is an example of a more extensive configuration file.
"battery_info": [1e6, 100, 256]
},
"sensor_coordinates": {
"Mics": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Baros_P": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Baros_T": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Diff_Baros": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Acc": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Gyro": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Mag": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Analog Vbat": [[0, 0, 0]],
"Constat": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"battery_info": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
"Mics": "mics_coordinate_reference",
"Baros_P": "baros_coordinate_reference",
"Baros_T": "baros_coordinate_reference",
"Diff_Baros": "baros_coordinate_reference",
"Acc": "accelerometers_coordinate_reference",
"Gyro": "gyroscopes_coordinate_reference",
"Mag": "magnetometers_coordinate_reference"
},
"sensor_names": [
"Mics",
Expand All @@ -330,4 +207,3 @@ Here is an example of a more extensive configuration file.
"description": null
}
}
6 changes: 3 additions & 3 deletions tests/test_cloud_functions/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def test_error_raised_if_installation_reference_already_exists(self):
"reference": "hello",
"receiver_firmware_version": "0.0.1",
"turbine_id": "0",
"sensor_coordinates": {"blah_sensor": [[0, 0, 0]]},
"sensor_coordinates": {"blah_sensor": "coordinate_reference"},
}
)

Expand All @@ -408,7 +408,7 @@ def test_error_raised_if_internal_server_error_occurs(self):
"reference": "hello",
"receiver_firmware_version": "0.0.1",
"turbine_id": "0",
"sensor_coordinates": {"blah_sensor": [[0, 0, 0]]},
"sensor_coordinates": {"blah_sensor": "coordinate_reference"},
}
)

Expand Down Expand Up @@ -444,7 +444,7 @@ def test_create_installation_with_only_required_inputs(self):
"reference": "hello",
"receiver_firmware_version": "0.0.1",
"turbine_id": "0",
"sensor_coordinates": {"blah_sensor": [[0, 0, 0]]},
"sensor_coordinates": {"blah_sensor": "coordinate_reference"},
}
)

Expand Down
137 changes: 7 additions & 130 deletions tests/valid_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,136 +221,13 @@
"battery_info": [1e6, 100, 256]
},
"sensor_coordinates": {
"Mics": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Baros_P": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Baros_T": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Diff_Baros": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Acc": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Gyro": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Mag": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"Analog Vbat": [[0, 0, 0]],
"Constat": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
],
"battery_info": [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
"Mics": "mics_coordinate_reference",
"Baros_P": "baros_coordinate_reference",
"Baros_T": "baros_coordinate_reference",
"Diff_Baros": "baros_coordinate_reference",
"Acc": "accelerometers_coordinate_reference",
"Gyro": "gyroscopes_coordinate_reference",
"Mag": "magnetometers_coordinate_reference"
},
"sensor_names": [
"Mics",
Expand Down

0 comments on commit 1a2d373

Please sign in to comment.