Skip to content

Commit

Permalink
edit submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
peetal committed Mar 29, 2024
1 parent 9ca4fed commit 5b69eaa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions bgfc_kit/bgfc_analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from sklearn.pipeline import Pipeline
from subprocess import call
from scipy.stats import sem
from .structDict import recurseCreateStructDict

def unpack_conf(FIRdesignMat_conf_dir:str, postfMRIprep_conf_dir:str):

Expand Down
22 changes: 18 additions & 4 deletions bgfc_kit/demo/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"id": "ec0276fe-41f0-40dc-9c85-c8bb96ff4acc",
"metadata": {},
"outputs": [
Expand All @@ -68,7 +68,7 @@
}
],
"source": [
"import bgfc_kit, importlib, inspect, pkgutil\n",
"import bgfc_kit, importlib, inspect, pkgutil, os\n",
"package = importlib.import_module('bgfc_kit')\n",
"print(f\"Submodules of bgfc_kit:\")\n",
"for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):\n",
Expand Down Expand Up @@ -387,10 +387,24 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 4,
"id": "9b039438-519c-4e40-ab70-558e432ccfca",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'toml' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m atlas \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/projects/hulacon/peetal/divatten/post_fMRIPrep_pip_motionCorr\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msub-001\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtransformed_atlas\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msub-001_schaefer200_T1W.nii.gz\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 6\u001b[0m subject_list \u001b[38;5;241m=\u001b[39m [\u001b[38;5;241m1\u001b[39m] \u001b[38;5;66;03m# we only look at the first subject we have just preprocessed\u001b[39;00m\n\u001b[0;32m----> 7\u001b[0m \u001b[43mplot_parcel_FIR_estimates\u001b[49m\u001b[43m(\u001b[49m\u001b[43mFIRdesignMat_conf_dir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostfMRIprep_conf_dir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43matlas\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.conda/envs/plenv/lib/python3.8/site-packages/bgfc_kit/bgfc_analyses.py:488\u001b[0m, in \u001b[0;36mplot_parcel_FIR_estimates\u001b[0;34m(FIRdesignMat_conf_dir, postfMRIprep_conf_dir, parcel_id, sub_list, atlas)\u001b[0m\n\u001b[1;32m 464\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;124;03mThis function plots the estimates of FIR regressors across all subjects. These plots should serve \u001b[39;00m\n\u001b[1;32m 466\u001b[0m \u001b[38;5;124;03mas sanity checks for FIR model efficiency. The plot should reveal boxcart shape reflecting condition structure.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[38;5;124;03m FIR estimates for a specific parcel. \u001b[39;00m\n\u001b[1;32m 485\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 487\u001b[0m \u001b[38;5;66;03m# unpack configuration files for important information\u001b[39;00m\n\u001b[0;32m--> 488\u001b[0m fir_cfg, preprocess_cfg \u001b[38;5;241m=\u001b[39m \u001b[43munpack_conf\u001b[49m\u001b[43m(\u001b[49m\u001b[43mFIRdesignMat_conf_dir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostfMRIprep_conf_dir\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 489\u001b[0m base_dir \u001b[38;5;241m=\u001b[39m preprocess_cfg\u001b[38;5;241m.\u001b[39moutput_dir\n\u001b[1;32m 491\u001b[0m signal_array \u001b[38;5;241m=\u001b[39m []\n",
"File \u001b[0;32m~/.conda/envs/plenv/lib/python3.8/site-packages/bgfc_kit/bgfc_analyses.py:42\u001b[0m, in \u001b[0;36munpack_conf\u001b[0;34m(FIRdesignMat_conf_dir, postfMRIprep_conf_dir)\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[38;5;66;03m# load FIRdesignMat configuration file\u001b[39;00m\n\u001b[1;32m 41\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(FIRdesignMat_conf_dir, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m toml_file:\n\u001b[0;32m---> 42\u001b[0m fir_cfg \u001b[38;5;241m=\u001b[39m \u001b[43mtoml\u001b[49m\u001b[38;5;241m.\u001b[39mload(toml_file)\n\u001b[1;32m 43\u001b[0m fir_cfg \u001b[38;5;241m=\u001b[39m recurseCreateStructDict(fir_cfg)\n\u001b[1;32m 44\u001b[0m fir_cfg \u001b[38;5;241m=\u001b[39m fir_cfg\u001b[38;5;241m.\u001b[39mPARAMETERS\n",
"\u001b[0;31mNameError\u001b[0m: name 'toml' is not defined"
]
}
],
"source": [
"from bgfc_kit.bgfc_analyses import plot_parcel_FIR_estimates\n",
"# specify the necessary inputs\n",
Expand Down

0 comments on commit 5b69eaa

Please sign in to comment.