Skip to content
Snippets Groups Projects
Commit 313aedbd authored by Ryan Godwin's avatar Ryan Godwin
Browse files

Minor updates to main and meg to ica

parent 48361590
No related branches found
No related tags found
1 merge request!1Progress toward getting the evaluation integrated
......@@ -61,8 +61,9 @@ def extract_ica_from_meg(
)
MNE_proc.process()
fig, ax = MNE_proc.plot()
#TODO add plotting here
# fig, ax = MNE_proc.plot()
logger.info("✅ ICA successfully calculated on MEG data with MNE")
with mlflow.start_run(run_name=run_name) as run:
......@@ -71,30 +72,13 @@ def extract_ica_from_meg(
mlflow.log_params(args)
mlflow.log_artifact(full_csv_output_path)
# ###############################################################################
# # filter dataframe to only heartifact and Time index
# indices_to_filter = [0, heartifact + 1]
# df = pd.read_csv(full_csv_output_path)
# df = df.iloc[:, indices_to_filter]
# df.to_csv(full_csv_output_path, index=False)
# ###############################################################################
# # feed .mat filepath and heartifact list to Get_RR_Intervals.py to get RR intervals for each heartifact
# getRR = data.GetRRComponent(output_sub_dir, scan_file, full_csv_output_path, heartifact)
# # getRR = Get_RR_Intervals.GetRRIntervals(scan_file, heartifacts)
# getRR.get_RR_intervals()
# Save to config
# Save to config folder
open(Path(config.CONFIG_DIR, "run_id.txt"), "w", encoding="utf-8").write(run_id)
if counter < len(scan_files):
counter = counter + 1
print("counter - ", counter)
else:
output_filepath = Path(config.CONFIG_DIR, "output_ic.txt")
output_filepath = Path(config.INTERMEDIATE_DIR, "output_ica_files.txt")
with open(output_filepath, "w", encoding="utf-8") as f:
for item in output_files:
str_item = str(item)
......@@ -118,7 +102,7 @@ def label_cardiac_ic(
run_name (str): str = "sgd",. Defaults to sgd
test_run (bool): bool = False,. Defaults to False
"""
input_filepaths = open(Path(config.CONFIG_DIR, "output_ic.txt"), "r")
input_filepaths = open(Path(config.INTERMEDIATE_DIR, "output_ica_files.txt"), "r")
input_list = input_filepaths.read()
input_list
for file in input_list.split(","):
......
......@@ -114,10 +114,4 @@ class MNE_Processor:
self._ica_ = np.array(sigi).T
return {"args": self.args}
def plot(self):
N = len(self._time_.shape[1])
fig, ax = plt.subplots(len(self._time_.shape[1]), 1, figsize=(7, 5))
for idx in range(len(N)):
ax[idx].plot(self._time_, self._ica_[idx])
return fig, ax
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment