{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook is set up to be used with Python 3(.6+). Also to properly run this notebook the following libraries need to be installed:\n", "- `pip install matplotlib`\n", "- `pip install numpy`\n", "- `pip install pandas`\n", "- `pip install nixio==1.5.0b4`\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# First lets check which files are available to us in the general and in the excercise folder\n", "import os\n", "\n", "os.listdir()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "os.listdir(\"./excercise\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Use the pandas library to read in columns from CSV files\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# The raw data files do not provide column headers so we'll write them first.\n", "# Check the \"README.md\" files for details.\n", "col_names = [\"current_frame\", \"time_elapsed\", \"obj_substracted\", \"substracted_value\", \"obj_value\", \"obj_size\", \"background_value\", \"x_old\", \"y_old\"]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Read the content of the first file.\n", "content = pd.read_csv(\"./excercise/20121202Pflp178GCaMP5kN2shift_210421W1bag.log\", header=None, names=col_names)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Briefly check the content\n", "content" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Plot raw data to get a general idea how it looks like\n", "import matplotlib.pyplot as plot\n", "\n", "x = content[\"current_frame\"]\n", "y = content[\"obj_substracted\"]\n", "plot.plot(x,y)\n", "plot.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we are set\n", "- create a NIX file and a Block in it.\n", "- create a DataArray for each raw data file and transfer the data of one of the columns.\n", "- properly add Dimensions, labels and units.\n", "- plot the data from the data stored in the NIX file.\n", "- add meaningful metadata to the general NIX file and the individual DataArrays from information found in the README.md.\n", "- connect all three DataArrays via a MultiTag. You can use the shift paradim as a reference or come up with your own points of interest.\n", "- Plot the data using the MultiTag.\n", "- If you work with Binder, make sure you regularly download the notebook to your local machine." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create a new, writeable NIX file. Don't forget to close it when you are done.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create a Block to store Data in, use an appropriate naming and type scheme.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create a DataArray on the block with the already loaded data above.\n", "# Again use appropriate naming and type, label and unit.\n", "# Make sure you can identify the corresponding data later on.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Add the appropriate two dimensions to the DataArray.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Plot data from the DataArray and compare to the plot above.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Add DataArrays for the other two data files as well.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create metadata Sections and Properties in the file to document general metadata e.g. Species and Hardware\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create metadata Sections specific to the DataArrays, document metadata specific to the raw data \n", "# and connect them to the appropriate DataArrays.\n", "# Where appropriate try to add units to the Property values via the \"property.unit\" method.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Try to access the saved metadata from the DataArrays\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Use a MultiTag to connect all three DataArrays via a common region of interest\n", "# e.g. using the experiments' stimulus protocol oxygen upshift from t1 110s to t2 470s\n", "# or define your own region of interest. You will need an additional DataArray providing \n", "# this region of interest. Connect the three DataArrays to the MultiTag after it has been\n", "# created.\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.1" } }, "nbformat": 4, "nbformat_minor": 4 }