|
33 | 33 | "cell_type": "markdown", |
34 | 34 | "metadata": {}, |
35 | 35 | "source": [ |
36 | | - "The package is designed to **process NeuroPixels ephys data** with **OpenEphys** and spike sorted with **Kilosort**." |
| 36 | + "The package is designed to **process NeuroPixels ephys data** with **OpenEphys** and spike sorted with **Kilosort**. The following Diagram corresponds to the `ephys_acute` module:" |
37 | 37 | ] |
38 | 38 | }, |
39 | 39 | { |
|
73 | 73 | "\n", |
74 | 74 | "**- Step 4: Curate the Clustering Results (Optional)**\n", |
75 | 75 | "\n", |
76 | | - "**- Step 4: Visualize the Results**" |
| 76 | + "**- Step 5: Visualize the Results**" |
77 | 77 | ] |
78 | 78 | }, |
79 | 79 | { |
|
83 | 83 | "### **Setup**" |
84 | 84 | ] |
85 | 85 | }, |
| 86 | + { |
| 87 | + "cell_type": "markdown", |
| 88 | + "metadata": {}, |
| 89 | + "source": [ |
| 90 | + "This tutorial examines the `ephys_acute` module applied to physiological recordings and automatic ingestion of spike sorting results.\n", |
| 91 | + "\n", |
| 92 | + "The goal is to store, track and manage different curations of the spike sorting results and unit-level visualization results.\n", |
| 93 | + "\n", |
| 94 | + "The results of this Element example can be combined with other modalities to create a complete customizable data pipeline for your specific lab or study. For instance, you can combine `element-array-ephys` with `element-calcium-imaging` and `element-deeplabcut` to characterize the neural activity." |
| 95 | + ] |
| 96 | + }, |
86 | 97 | { |
87 | 98 | "cell_type": "markdown", |
88 | 99 | "metadata": {}, |
|
603 | 614 | "ephys.Clustering.populate(session_key, display_progress=True)" |
604 | 615 | ] |
605 | 616 | }, |
| 617 | + { |
| 618 | + "cell_type": "markdown", |
| 619 | + "metadata": {}, |
| 620 | + "source": [ |
| 621 | + "### **Step 4: Curate the Clustering Results (Optional)**" |
| 622 | + ] |
| 623 | + }, |
606 | 624 | { |
607 | 625 | "attachments": {}, |
608 | 626 | "cell_type": "markdown", |
|
657 | 675 | "cell_type": "markdown", |
658 | 676 | "metadata": {}, |
659 | 677 | "source": [ |
660 | | - "Now that we've populated the tables in this workflow, there are one of\n", |
661 | | - "several next steps. If you have an existing workflow for\n", |
| 678 | + "Now that we've populated the tables in this DataJoint pipeline, there are one of\n", |
| 679 | + "several next steps. If you have an existing pipeline for\n", |
662 | 680 | "aligning waveforms to behavior data or other stimuli, you can easily\n", |
663 | 681 | "invoke `element-event` or define your custom DataJoint tables to extend the\n", |
664 | | - "pipeline.\n", |
665 | | - "\n", |
666 | | - "In this tutorial, we will do some exploratory analysis by fetching the data from the database and creating a few plots.\n", |
667 | | - "\n", |
668 | | - "## Querying Data\n", |
669 | | - "\n", |
670 | | - "DataJoint provides a powerful querying system, allowing you to retrieve and work with data stored in your database seamlessly. In this section, we'll explore the fundamental querying concepts.\n", |
671 | | - "\n", |
672 | | - "#### What is a Query?\n", |
673 | | - "\n", |
674 | | - "- A query is essentially a request for data. With DataJoint, you can craft specific queries to fetch data that meets your criteria from the database.\n", |
675 | | - "\n", |
676 | | - "#### The `fetch()` Method\n", |
677 | | - "\n", |
678 | | - "- The primary method for retrieving data from a DataJoint table is `fetch()`.\n", |
679 | | - "- **Default Behavior**: Without any arguments, `fetch()` returns a list of dictionaries. Each dictionary corresponds to an entry in the table.\n", |
680 | | - " \n", |
681 | | - "#### The `fetch1()` Method\n", |
682 | | - "\n", |
683 | | - "- For tables with a single entry or when you're only interested in the first entry, use `fetch1()`.\n", |
684 | | - "- **Default Behavior**: It returns a dictionary of attributes for that one entry.\n", |
685 | | - "\n", |
686 | | - "#### Specific Attributes\n", |
687 | | - "\n", |
688 | | - "- Both `fetch()` and `fetch1()` can be made more specific by providing attributes.\n", |
689 | | - "- Example: `fetch1('fps')` will retrieve only the `fps` attribute from the first entry.\n", |
690 | | - "\n", |
691 | | - "#### Restricting Queries\n", |
692 | | - "\n", |
693 | | - "- Often, you don't want to fetch everything. Instead, you might want data related to a specific subject or session.\n", |
694 | | - "- DataJoint uses the `&` operator to restrict queries.\n", |
695 | | - "- Example: To get all session times for `subject5`, you might use:\n", |
696 | | - " ```python\n", |
697 | | - " subject1_times = (session.Session & \"subject = 'subject1'\").fetch(\"session_datetime\")\n", |
698 | | - " ```\n", |
699 | | - "\n", |
700 | | - "#### Fetching Primary Keys\n", |
701 | | - "\n", |
702 | | - "- Sometimes, you just need the primary keys of entries.\n", |
703 | | - "- Use the `fetch(\"KEY\")` syntax for this. For instance, `(session.Session).fetch(\"KEY\")`.\n", |
704 | | - "\n", |
705 | | - "#### Let's Dive In!\n", |
706 | | - "\n", |
707 | | - "Now that we've established the basics, let's delve deeper into querying with some practical examples." |
| 682 | + "pipeline." |
| 683 | + ] |
| 684 | + }, |
| 685 | + { |
| 686 | + "cell_type": "markdown", |
| 687 | + "metadata": {}, |
| 688 | + "source": [ |
| 689 | + "### **Step 5: Visualization of Results**" |
| 690 | + ] |
| 691 | + }, |
| 692 | + { |
| 693 | + "cell_type": "markdown", |
| 694 | + "metadata": {}, |
| 695 | + "source": [ |
| 696 | + "In this tutorial, we will do some exploratory analysis by fetching the data from the database and creating a few plots." |
708 | 697 | ] |
709 | 698 | }, |
710 | 699 | { |
|
825 | 814 | "cell_type": "markdown", |
826 | 815 | "metadata": {}, |
827 | 816 | "source": [ |
828 | | - "## Conclusion\n", |
| 817 | + "## Summary\n", |
829 | 818 | "\n", |
| 819 | + "Following this tutorial, we've efficiently: \n", |
| 820 | + "- covered the essential functionality of `element-array-ephys`\n", |
| 821 | + "- acquired the skills to register the electrophysiology recordings for each probe in each experimental session\n", |
| 822 | + "- insert data into tables\n", |
| 823 | + "- execute the spike sort with Kilosort\n", |
| 824 | + "- visualize the results " |
| 825 | + ] |
| 826 | + }, |
| 827 | + { |
| 828 | + "cell_type": "markdown", |
| 829 | + "metadata": {}, |
| 830 | + "source": [ |
| 831 | + "#### Documentation and DataJoint tutorials" |
| 832 | + ] |
| 833 | + }, |
| 834 | + { |
| 835 | + "cell_type": "markdown", |
| 836 | + "metadata": {}, |
| 837 | + "source": [ |
| 838 | + "For detailed documentation on `element-array-ephys`:\n", |
| 839 | + "\n", |
| 840 | + "[`DataJoint Element for Extracellular Electrophysiology - Documentation`](https://datajoint.com/docs/elements/element-array-ephys/)" |
| 841 | + ] |
| 842 | + }, |
| 843 | + { |
| 844 | + "cell_type": "markdown", |
| 845 | + "metadata": {}, |
| 846 | + "source": [ |
| 847 | + "For detailed documentation and tutorials on general DataJoint principles that support collaboration, automation, reproducibility, and visualizations:\n", |
| 848 | + "\n", |
| 849 | + "[`DataJoint for Python - Interactive Tutorials`](https://github.com/datajoint/datajoint-tutorials) covers fundamentals, including table tiers, query operations, fetch operations, automated computations with the make function, and more.\n", |
| 850 | + "\n", |
| 851 | + "[`DataJoint for Python - Documentation`](https://datajoint.com/docs/core/datajoint-python/0.14/)" |
| 852 | + ] |
| 853 | + }, |
| 854 | + { |
| 855 | + "cell_type": "markdown", |
| 856 | + "metadata": {}, |
| 857 | + "source": [ |
| 858 | + "#### Run this tutorial on your own data" |
| 859 | + ] |
| 860 | + }, |
| 861 | + { |
| 862 | + "cell_type": "markdown", |
| 863 | + "metadata": {}, |
| 864 | + "source": [ |
830 | 865 | "Throughout this notebook, we've used DataJoint to work with database tables and keep\n", |
831 | 866 | "data organized and automate analyses to increase efficiency of data processing. We've\n", |
832 | 867 | "inserted data into tables, used queries to retrieve, manipulate, and visualize ephys data.\n", |
833 | 868 | "\n", |
834 | 869 | "Remember, this is just the beginning. As you grow familiar with DataJoint, you'll\n", |
835 | 870 | "uncover even more ways to harness its capabilities for your specific research needs. \n", |
836 | 871 | "\n", |
837 | | - "---\n", |
838 | 872 | "\n", |
839 | 873 | "To run this tutorial notebook on your own data, please use the following steps:\n", |
840 | 874 | "- Download the mysql-docker image for DataJoint and run the container according to the\n", |
|
857 | 891 | "\n", |
858 | 892 | "- Run this code block above and proceed with the rest of the notebook." |
859 | 893 | ] |
860 | | - }, |
861 | | - { |
862 | | - "cell_type": "code", |
863 | | - "execution_count": null, |
864 | | - "metadata": {}, |
865 | | - "outputs": [], |
866 | | - "source": [ |
867 | | - "**Additional Resources:**\n", |
868 | | - "- [Interactive Tutorials](https://github.com/datajoint/datajoint-tutorials) on `datajoint-python`: Dive deep into DataJoint's fundamentals.\n", |
869 | | - "- [*`datajoint-python`* Documentation](https://datajoint.com/docs/core/datajoint-python/): Comprehensive documentation on DataJoint for Python.\n", |
870 | | - "- [Element Array Electrophysiology Documentation](https://datajoint.com/docs/elements/element-array-ephys/): Detailed guide on the DataJoint Element for Array Electrophysiology.\n" |
871 | | - ] |
872 | 894 | } |
873 | 895 | ], |
874 | 896 | "metadata": { |
|
0 commit comments