Skip to content

Commit

Permalink
bugfix: 2D array data should validate
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Aug 25, 2023
1 parent ec54f28 commit 6794b5b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AnalogSignal(BaseModel):
name: str
times_dimensionality: str
values_units: str
values: list[float]
values: list[float] | list[list[float]]
times: list[float] | None = None

@classmethod
Expand Down
18 changes: 18 additions & 0 deletions api/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@ def test_get_analogsignal_data(self):

assert json_data["values_units"] == value_units[analogsignal_id]

def test_get_analogsignal_data_2(self):
test_file = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/intan/intan_rhd_test_1.rhd"
params = urllib.parse.urlencode(
{"url": test_file, "segment_id": 0, "analog_signal_id": 0, "type": "IntanIO", "down_sample_factor": 1000}
)
response = test_client.get(f"/api/analogsignaldata/?{params}")
assert response.status_code == 200
json_data = response.json()
assert json_data["t_start"] == 0.0
assert json_data["t_stop"] == 1.0
assert json_data["sampling_period"] == 3.3333333333333335e-02
assert json_data["name"] == "RHD2000 amplifier channel"
assert json_data["times_dimensionality"] == "s"
assert json_data["values_units"] == "uV"
assert len(json_data["values"]) == 192
assert len(json_data["values"][0]) == 30
assert len(json_data["values"][191]) == 30

def test_spiketrain(self):
test_file = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/neuroexplorer/File_neuroexplorer_1.nex"
params = urllib.parse.urlencode(
Expand Down

0 comments on commit 6794b5b

Please sign in to comment.