pERG Examples

First we need to create our NWB object, we’ll use this generic one

 1from simply_nwb import SimpleNWB
 2import pendulum
 3from pynwb.file import Subject
 4
 5
 6def nwb_gen():
 7    return SimpleNWB.create_nwb(
 8        # Required
 9        session_description="Mouse cookie eating session",
10        # Subtract 1 year so we don't run into the 'NWB start time is at a greater date than current' issue
11        session_start_time=pendulum.now().subtract(years=1),
12        experimenter=["Schmoe, Joe"],
13        lab="Felsen Lab",
14        experiment_description="Gave a mouse a cookie",
15
16        # Optional
17        identifier="cookie_0",
18        subject=Subject(**{
19            "subject_id": "1",
20            "age": "P90D",  # ISO-8601 for 90 days duration
21            "strain": "TypeOfMouseGoesHere",  # If no specific used, 'Wild Strain'
22            "description": "Mouse#2 idk",
23            "sex": "M",  # M - Male, F - Female, U - unknown, O - other
24            # NCBI Taxonomy link or Latin Binomial (e.g.'Rattus norvegicus')
25            "species": "http://purl.obolibrary.org/obo/NCBITaxon_10116",
26        }),
27        session_id="session0",
28        institution="CU Anschutz",
29        keywords=["mouse"],
30
31        # related_publications="DOI::LINK GOES HERE FOR RELATED PUBLICATIONS"
32    )

An example usage of pERG functions is as follows

 1from simply_nwb import SimpleNWB
 2from gen_nwb import nwb_gen
 3
 4
 5def nwb_perg():
 6    nwb = nwb_gen()
 7    SimpleNWB.p_erg_add_data(nwb, "../data/pg1_A_raw.TXT", "perg_table", description="test desc")
 8    SimpleNWB.p_erg_add_data(nwb, "../data/pg1_A_raw.TXT", "perg_table", description="test desc")
 9    SimpleNWB.p_erg_add_folder(nwb, foldername="../data/pg_folder", file_pattern="*.txt", table_name="p_ergs", description="test desc")
10
11    t = nwb.acquisition["perg_table_data"]["average"][:]
12    t = nwb.acquisition["meta_channel"].data[:]
13    return nwb, ["check_regular_timestamps"]