Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pixelmap/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,17 @@ def format_wiring_df(wiring_df):
"""
# add shank id to electrode id, in dataframe's cells
df = wiring_df.copy()
new_columns = {}
for column in df.columns[1:]:
shank_id = int(column[5])
electrode_ids = df.loc[:, column].values
shank_electrode_ids = np.vstack([np.zeros(len(electrode_ids)) + shank_id, electrode_ids]).T
shank_electrode_ids = [tuple(se) for se in shank_electrode_ids]
df[column] = df[column].astype(object)
df[column] = shank_electrode_ids
# object-dtype Series so each cell holds a (shank_id, electrode_id) tuple
new_columns[column] = pd.Series(
[tuple(se) for se in shank_electrode_ids], index=df.index, dtype=object
)

return df
return df.assign(**new_columns)


def _imro_format_for(probe_subtype, probe_type):
Expand Down
11 changes: 7 additions & 4 deletions pixelmap/utils/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ def parse_survey_file(content: str) -> pd.DataFrame:
f"Expected header: Shank\\tXum\\tZum\\tVal."
)

df = df[list(SURVEY_COLUMNS)].copy()
for col in ("shank", "xum", "zum"):
df[col] = pd.to_numeric(df[col], errors="raise").astype(int)
df["val"] = pd.to_numeric(df["val"], errors="raise").astype(float)
df = df[list(SURVEY_COLUMNS)]
df = df.assign(
shank=pd.to_numeric(df["shank"], errors="raise"),
xum=pd.to_numeric(df["xum"], errors="raise"),
zum=pd.to_numeric(df["zum"], errors="raise"),
val=pd.to_numeric(df["val"], errors="raise"),
).astype({"shank": int, "xum": int, "zum": int, "val": float})
return df


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies = [
"panel>=1.3.0",
"matplotlib>=3.7.0",
"numpy>=1.24.0",
"pandas>=2.0.0",
"pandas>=2.3",
"param>=1.13.0",
"bokeh>=3.0.0",
"dotenv>=0.9.9",
Expand Down
Loading