Skip to content

Commit

Permalink
Merge pull request #309 from CAMBI-tech/logging-fix
Browse files Browse the repository at this point in the history
Logging fix
  • Loading branch information
sreekaroo authored Feb 6, 2024
2 parents a4b39a1 + bf7dc79 commit a03cad1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 4 additions & 7 deletions bcipy/simulator/helpers/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ def fmt_likelihoods_for_hist(likelihoods, alp):
return formatted


def format_sample_rows(sample_rows: List[pd.DataFrame]):
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)


def fmt_reshaped_evidence(evidences: Dict[str, SimEvidence]):
Expand Down
5 changes: 3 additions & 2 deletions bcipy/simulator/helpers/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ def sample(self, state: SimState) -> np.ndarray:
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

0 comments on commit a03cad1

Please sign in to comment.