Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging fix #309

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 4 additions & 7 deletions bcipy/simulator/helpers/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ def format_alp_likelihoods(likelihoods, alp):
return formatted


def format_sample_rows(sample_rows: List[pd.Series]):
formatted_rows = []
for row in sample_rows:
new_row = row.drop(columns=['eeg'], axis=1, inplace=False)
formatted_rows.append(new_row.to_string(index=False, header=True))

return ", ".join(formatted_rows)
def format_sample_rows(sample_rows: List[pd.Series]) -> str:
"""Returns a tabular representation of the sample rows."""
return pd.DataFrame(sample_rows).drop(columns=['eeg']).to_string(
index=False, header=True)
5 changes: 3 additions & 2 deletions bcipy/simulator/helpers/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ def sample(self, state: SimState) -> np.ndarray:
if not len(filtered_data):
raise TaskConfigurationException(message="No eeg sample found with provided data and query")

row = filtered_data.sample(1)
row = filtered_data.sample(1).iloc[0]
sample_rows.append(row)

log.debug(f"EEG Samples: \n {format_sample_rows(sample_rows)}")
eeg_responses = [r['eeg'].to_numpy()[0] for r in sample_rows]

eeg_responses = [r['eeg'] for r in sample_rows]
sample = self.model_input_reshaper(eeg_responses)

return sample
Expand Down
Loading