From 1c1b7fa57ab0c377e0ca6e4b398696d80669095f Mon Sep 17 00:00:00 2001 From: Scott Lowe Date: Tue, 15 Jun 2021 09:30:43 +0100 Subject: [PATCH] JNB: Change to using datetime for the output directory --- examples/Basic usage - Functional.ipynb | 29 +++++++++++++++++++++---- examples/Basic usage.ipynb | 29 ++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/examples/Basic usage - Functional.ipynb b/examples/Basic usage - Functional.ipynb index 43fad97c..25075caf 100644 --- a/examples/Basic usage - Functional.ipynb +++ b/examples/Basic usage - Functional.ipynb @@ -252,12 +252,33 @@ "metadata": {}, "outputs": [], "source": [ - "# Define the folder where FISSA's outputs will be cached.\n", + "# Define the folder where FISSA's outputs will be cached, so they can be\n", + "# quickly reloaded in the future without having to recompute them.\n", + "#\n", + "# This argument is optional; if it is not provided, FISSA will not save its\n", + "# results for later use.\n", "#\n", "# Note: you *must* use a different folder for each experiment.\n", + "#\n", + "# In this example, we will use the current datetime as the\n", + "# name of the experiment, but you can name your experiments\n", + "# however you want to.\n", + "\n", + "import datetime\n", "\n", - "output_folder = \"fissa_example\"\n", + "output_folder = \"fissa-example_{}\".format(\n", + " datetime.datetime.now().strftime(\"%Y-%m-%d_%H-%M-%S\")\n", + ")\n", "\n", + "print(output_folder)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "# Run FISSA, saving to the output directory\n", "result = fissa.run_fissa(images_location, rois_location, output_folder)" ] @@ -313,7 +334,7 @@ "These interface similarly as `experiment.ROIs`, `experiment.raw`, and `experiment.result` described above. However, Matlab counts from 1 (as opposed to Python counting from 0), such that the ROI, raw trace, and decontaminated trace are all found for cell 0 trial 0 as:\n", "\n", "```octave\n", - "data = load(\"fissa_example/matlab.mat\")\n", + "data = load(\"experiment_results.mat\")\n", "data.ROIs.cell0.trial0{1} % polygon for the ROI\n", "data.ROIs.cell0.trial0{2} % polygon for first neuropil subregion\n", "data.result.cell0.trial0(1, :) % final extracted cell signal\n", @@ -363,7 +384,7 @@ "alpha = 0.1\n", "\n", "# If you change the experiment parameters, you need to change the cache directory too\n", - "output_folder2 = \"fissa_example2\"\n", + "output_folder2 = \"fissa-example-alt\"\n", "\n", "# Run FISSA with these parameters\n", "result = fissa.run_fissa(\n", diff --git a/examples/Basic usage.ipynb b/examples/Basic usage.ipynb index f5bb8585..093e79d8 100755 --- a/examples/Basic usage.ipynb +++ b/examples/Basic usage.ipynb @@ -82,7 +82,34 @@ "```\n", "Defining a different roiset per image can be useful if you need to adjust for motion drift for example.\n", "\n", - "Then, we can define out experiment:" + "Then, we can define our experiment:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Define the folder where FISSA's outputs will be cached, so they can be\n", + "# quickly reloaded in the future without having to recompute them.\n", + "#\n", + "# This argument is optional; if it is not provided, FISSA will not save its\n", + "# results for later use.\n", + "#\n", + "# Note: you *must* use a different folder for each experiment.\n", + "#\n", + "# In this example, we will use the current datetime as the\n", + "# name of the experiment, but you can name your experiments\n", + "# however you want to.\n", + "\n", + "import datetime\n", + "\n", + "output_folder = \"fissa-example_{}\".format(\n", + " datetime.datetime.now().strftime(\"%Y-%m-%d_%H-%M-%S\")\n", + ")\n", + "\n", + "print(output_folder)" ] }, {