Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added NWB file example #342

Merged
merged 6 commits into from
Dec 22, 2022
Merged

Added NWB file example #342

merged 6 commits into from
Dec 22, 2022

Commits on Dec 7, 2022

  1. Added NWB file example

    TheChymera committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    57e9362 View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2022

  1. Actual NWB files created with:

    ```
    import os
    from uuid import uuid4
    from datetime import datetime, timezone
    from dateutil.tz import tzlocal, tzutc
    import pynwb
    from dandi.pynwb_utils import make_nwb_file, metadata_nwb_file_fields
    
    def simple1_nwb_metadata():
        # very simple assignment with the same values as the key with 1 as suffix
        metadata = {f: f"{f}1" for f in metadata_nwb_file_fields}
        metadata["identifier"] = uuid4().hex
        # subject_fields
    
        # tune specific ones:
        # Needs an explicit time zone since otherwise pynwb would add one
        # But then comparison breaks anyways any ways yoh have tried to set it
        # for datetime.now.  Taking example from pynwb tests
        metadata["session_start_time"] = datetime(2017, 4, 15, 12, tzinfo=tzutc())
        metadata["keywords"] = ["keyword1", "keyword 2"]
        # since NWB 2.1.0 some fields values become "arrays" which are
        # then reloaded as tuples, so we force them being tuples here
        # See e.g. NeurodataWithoutBorders/pynwb#1091
        for f in "related_publications", "experimenter":
            metadata[f] = (metadata[f],)
        return metadata
    
    for i in os.listdir("."):
        if i.endswith("nwb"):
            b = simple1_nwb_metadata()
            a = make_nwb_file(
                i,
                subject=pynwb.file.Subject(
                    subject_id="01",
                    date_of_birth=datetime(2016, 12, 1, tzinfo=tzutc()),
                    sex="U",
                    species="Mus musculus",
                ),
                **b,
            )
            print(a)
    ```
    TheChymera committed Dec 8, 2022
    Configuration menu
    Copy the full SHA
    fbfce1f View commit details
    Browse the repository at this point in the history
  2. Descriptive README

    TheChymera committed Dec 8, 2022
    Configuration menu
    Copy the full SHA
    2cbf2c7 View commit details
    Browse the repository at this point in the history

Commits on Dec 22, 2022

  1. Configuration menu
    Copy the full SHA
    e72b3a8 View commit details
    Browse the repository at this point in the history
  2. Freely sharing metadata

    Comment:
    As per email correspondence with Philippe Kahane of the University of
    Grenoble, dated 2022-12-09, we can release this without restrictive
    licensing. Olivier David has not replied for multiple weeks now. I would
    suggest proceeding and notifying again via email. We are not releasing
    any data which is not already in this repository, we are simply updating
    the licensing to permit what has already been done with this repo the
    entire time.
    TheChymera committed Dec 22, 2022
    Configuration menu
    Copy the full SHA
    e9560e4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    18cb595 View commit details
    Browse the repository at this point in the history