Example #1
0
def test_general_intra():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    create_general_intra(fname)
    #
    val = ut.verify_present(fname, "general/optophysiology/", "image_custom")
    if not ut.strcmp(val, "IMAGE_CUSTOM"):
    #if val != "IMAGE_CUSTOM" and val != b"IMAGE_CUSTOM":
        ut.error("Checking custom", "Field value incorrect")
    #

    test_field(fname, "DESCRIPTION", "p1")
    test_field(fname, "DEVICE", "p1")
    test_field(fname, "EXCITATION_LAMBDA", "p1")
    test_field(fname, "IMAGE_SITE_CUSTOM", "p1")
    test_field(fname, "IMAGING_RATE", "p1")
    test_field(fname, "INDICATOR", "p1")
    test_field(fname, "LOCATION", "p1")
    val = ut.verify_present(fname, "general/optophysiology/p1/", "manifold")
    if len(val) != 2 or len(val[0]) != 2 or len(val[0][0]) != 3:
        ut.error("Checking manifold", "Incorrect dimensions")
    val = ut.verify_present(fname, "general/optophysiology/p1/red/", "description")
    if not ut.strcmp(val, "DESCRIPTION"):
        ut.error("Checking metadata", "field value incorrect")
    val = ut.verify_present(fname, "general/optophysiology/p1/green/", "description")
    if not ut.strcmp(val, "DESCRIPTION"):
        ut.error("Checking metadata", "field value incorrect")
    val = ut.verify_present(fname, "general/optophysiology/p1/red/", "emission_lambda")
    if not ut.strcmp(val, "CHANNEL_LAMBDA"):
        ut.error("Checking metadata", "field value incorrect")
    val = ut.verify_present(fname, "general/optophysiology/p1/green/", "emission_lambda")
    if not ut.strcmp(val, "CHANNEL_LAMBDA"):
        ut.error("Checking metadata", "field value incorrect")
Example #2
0
def test_axis(fname, iname, num):
    val = ut.verify_present(fname, iname, "axis_"+num+"_phase_map")
    if len(val) != 2 or len(val[0]) != 3:
        ut.error("Checking axis-"+num, "wrong dimension")
    if num == "1": 
        if val[0][0] != 1.0:
            ut.error("Checking axis-"+num, "wrong contents")
    elif num == "2":
        if val[0][0] != 3.0:
            ut.error("Checking axis-"+num+" contents", "wrong contents")
    val = ut.verify_attribute_present(fname, iname+"/axis_"+num+"_phase_map", "unit")
    if not ut.strcmp(val, "degrees"):
        ut.error("Checking axis-"+num+" unit", "Wrong value")
    val = ut.verify_attribute_present(fname, iname+"/axis_"+num+"_phase_map", "dimension")
    if val[0] != 2 or val[1] != 3:
        ut.error("Double-checking axis-"+num+" dimension", "Wrong value")
    val = ut.verify_attribute_present(fname, iname+"/axis_"+num+"_phase_map", "field_of_view")
    if val[0] != .1 or val[1] != .1:
        ut.error("Checking axis-"+num+" field-of-view", "Wrong value")
    # now check power map. it only exists for axis 1
    if num == "1":
        val = ut.verify_present(fname, iname, "axis_"+num+"_phase_map")
        if len(val) != 2 or len(val[0]) != 3:
            ut.error("Checking axis-"+num+" power map", "wrong dimension")
        val = ut.verify_attribute_present(fname, iname+"/axis_"+num+"_power_map", "dimension")
        if val[0] != 2 or val[1] != 3:
            ut.error("Double-checking axis-"+num+"-power dimension", "Wrong value")
        val = ut.verify_attribute_present(fname, iname+"/axis_"+num+"_power_map", "field_of_view")
        if val[0] != .1 or val[1] != .1:
            ut.error("Checking axis-"+num+"-power field-of-view", "Wrong value")
Example #3
0
def test_general_intra():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    create_general_intra(fname)
    #
    val = ut.verify_present(fname, "general/intracellular_ephys/", "intra_custom")
    if not ut.strcmp(val, "INTRA_CUSTOM"):
        ut.error("Checking custom", "Field value incorrect")
    #

    test_field(fname, "DESCRIPTION", "p1")
    test_field(fname, "FILTERING", "p1")
    test_field(fname, "DEVICE", "p1")
    test_field(fname, "LOCATION", "p1")
    test_field(fname, "RESISTANCE", "p1")
    test_field(fname, "SLICE", "p1")
    test_field(fname, "SEAL", "p1")
    test_field(fname, "INITIAL_ACCESS_RESISTANCE", "p1")
    test_field(fname, "INTRA_ELECTRODE_CUSTOM", "p1")
    #
    test_field(fname, "DESCRIPTION", "e2")
    test_field(fname, "FILTERING", "e2")
    test_field(fname, "DEVICE", "e2")
    test_field(fname, "LOCATION", "e2")
    test_field(fname, "RESISTANCE", "e2")
    test_field(fname, "SLICE", "e2")
    test_field(fname, "SEAL", "e2")
    test_field(fname, "INITIAL_ACCESS_RESISTANCE", "e2")
    test_field(fname, "INTRA_ELECTRODE_CUSTOM", "e2")
def test_refimage_series():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    name = "refimage"
    create_refimage(fname, name)
    val = ut.verify_present(fname, "/", "identifier")
    if not ut.strcmp(val, "vwx"):
        ut.error("Checking file idenfier", "wrong contents")
    val = ut.verify_present(fname, "/", "file_create_date")
    val = ut.verify_present(fname, "/", "session_start_time")
    if not ut.strcmp(val, "xyz"):
        ut.error("Checking session start time", "wrong contents")
    val = ut.verify_present(fname, "/", "session_description")
    if not ut.strcmp(val, "wxy"):
        ut.error("Checking session start time", "wrong contents")
Example #5
0
def test_refimage_series():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    name = "refimage"
    create_refimage(fname, name)
    val = ut.verify_present(fname, "/", "identifier")
    if not ut.strcmp(val, "vwx"):
        ut.error("Checking file idenfier", "wrong contents")
    val = ut.verify_present(fname, "/", "file_create_date")
    val = ut.verify_present(fname, "/", "session_start_time")
    if not ut.strcmp(val, "xyz"):
        ut.error("Checking session start time", "wrong contents")
    val = ut.verify_present(fname, "/", "session_description")
    if not ut.strcmp(val, "wxy"):
        ut.error("Checking session start time", "wrong contents")
Example #6
0
def test_refimage_series():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    name = "refimage"
    create_refimage(fname, name)
    val = ut.verify_present(fname, "acquisition/images/", name)
    #if len(val) != 6:
    if len(val) != 5:
        ut.error("Checking ref image contents", "wrong dimension")
    val = ut.verify_attribute_present(fname, "acquisition/images/"+name, "format")
    if not ut.strcmp(val, "raw"):
        ut.error("Checking ref image format", "Wrong value")
    val = ut.verify_attribute_present(fname, "acquisition/images/"+name, "description")
    if not ut.strcmp(val, "test"):
        ut.error("Checking ref image description", "Wrong value")
Example #7
0
def test_refimage_series():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    name = "refimage"
    create_refimage(fname, name)
    val = ut.verify_present(fname, "acquisition/images/", name)
    #if len(val) != 6:
    if len(val) != 5:
        ut.error("Checking ref image contents", "wrong dimension")
    val = ut.verify_attribute_present(fname, "acquisition/images/"+name, "format")
    if not ut.strcmp(val, "raw"):
        ut.error("Checking ref image format", "Wrong value")
    val = ut.verify_attribute_present(fname, "acquisition/images/"+name, "description")
    if not ut.strcmp(val, "test"):
        ut.error("Checking ref image description", "Wrong value")
Example #8
0
def test_isi_iface():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    name = "test_module"
    iname = "processing/" + name + "/ImagingRetinotopy"
    create_isi_iface(fname, name)

    test_axis(fname, iname, "1")
    test_axis(fname, iname, "2")
    val = ut.verify_present(fname, iname, "axis_descriptions")
    if len(val) != 2:
        ut.error("Checking axis_description", "wrong dimension")
    if not ut.strcmp(val[0], "altitude") or not ut.strcmp(val[1], "azimuth"):
        ut.error("Checking axis_description", "wrong contents")
    test_image(fname, iname, "vasculature_image")
    test_image(fname, iname, "focal_depth_image")
    test_sign_map(fname, iname)
def test_general_optogen():
    if __file__.startswith("./"):
        fname = "x" + __file__[3:-3] + ".nwb"
    else:
        fname = "x" + __file__[1:-3] + ".nwb"
    create_general_optogen(fname)
    #
    val = ut.verify_present(fname, "general/optogenetics/", "optogen_custom")
    if not ut.strcmp(val, "OPTOGEN_CUSTOM"):
        ut.error("Checking custom", "Field value incorrect")
    #

    test_field(fname, "DESCRIPTION", "p1")
    #test_field(fname, "DESCRIPTIONx", "p1")
    #test_field(fname, "DESCRIPTION", "p1x")
    test_field(fname, "DEVICE", "p1")
    test_field(fname, "LAMBDA", "p1")
    test_field(fname, "LOCATION", "p1")
    val = ut.verify_present(fname, "general/optogenetics/p1/", "optogen_site_custom") 
    if not ut.strcmp(val, "OPTOGEN_SITE_CUSTOM"):
        ut.error("Checking metadata", "field value incorrect")
Example #10
0
def test_general_optogen():
    if __file__.startswith("./"):
        fname = "x" + __file__[3:-3] + ".nwb"
    else:
        fname = "x" + __file__[1:-3] + ".nwb"
    create_general_optogen(fname)
    #
    val = ut.verify_present(fname, "general/optogenetics/", "optogen_custom")
    if not ut.strcmp(val, "OPTOGEN_CUSTOM"):
        ut.error("Checking custom", "Field value incorrect")
    #

    test_field(fname, "DESCRIPTION", "p1")
    #test_field(fname, "DESCRIPTIONx", "p1")
    #test_field(fname, "DESCRIPTION", "p1x")
    test_field(fname, "DEVICE", "p1")
    test_field(fname, "LAMBDA", "p1")
    test_field(fname, "LOCATION", "p1")
    val = ut.verify_present(fname, "general/optogenetics/p1/",
                            "optogen_site_custom")
    if not ut.strcmp(val, "OPTOGEN_SITE_CUSTOM"):
        ut.error("Checking metadata", "field value incorrect")
Example #11
0
def test_general_subject():
    if __file__.startswith("./"):
        fname = "x" + __file__[3:-3] + ".nwb"
    else:
        fname = "x" + __file__[1:-3] + ".nwb"
    create_general_subject(fname)
    val = ut.verify_present(fname, "general/subject/", "description")
    if not ut.strcmp(val, "SUBJECT"):
        ut.error("Checking metadata", "field value incorrect")
    test_field(fname, "SUBJECT_ID")
    test_field(fname, "SPECIES")
    test_field(fname, "GENOTYPE")
    test_field(fname, "SEX")
    test_field(fname, "AGE")
    test_field(fname, "WEIGHT")
def test_general_subject():
    if __file__.startswith("./"):
        fname = "s" + __file__[3:-3] + ".nwb"
    else:
        fname = "s" + __file__[1:-3] + ".nwb"
    create_general_subject(fname)
    val = ut.verify_present(fname, "general/subject/", "description")
    if not ut.strcmp(val, "SUBJECT"):
        ut.error("Checking metadata", "field value incorrect")
    test_field(fname, "SUBJECT_ID")
    test_field(fname, "SPECIES")
    test_field(fname, "GENOTYPE")
    test_field(fname, "SEX")
    test_field(fname, "AGE")
    test_field(fname, "WEIGHT")
Example #13
0
def test_image(fname, iname, img):
    val = ut.verify_present(fname, iname, img)
    if len(val) != 2 or len(val[0]) != 3:
        ut.error("Checking image "+img, "wrong dimension")
    if val[1][1] != 144:
        ut.error("Checking image "+img, "wrong contents")
    val = ut.verify_attribute_present(fname, iname+"/"+img, "format")
    if not ut.strcmp(val, "raw"):
        ut.error("Checking image "+img+" format", "wrong contents")
    val = ut.verify_attribute_present(fname, iname+"/"+img, "dimension")
    if len(val) != 2 or val[0] != 2 or val[1] != 3:
        ut.error("Checking image "+img+" dimension", "wrong contents")
    val = ut.verify_attribute_present(fname, iname+"/"+img, "bits_per_pixel")
    if val != 8:
        ut.error("Checking image "+img+" bpp", "wrong contents")
Example #14
0
def test_field(fname, name):
    val = ut.verify_present(fname, "general/subject/", name.lower())
    if not ut.strcmp(val, name):
        ut.error("Checking metadata", "field value incorrect")
def test_field(fname, name):
    val = ut.verify_present(fname, "general/subject/", name.lower())
    if not ut.strcmp(val, name):
        ut.error("Checking metadata", "field value incorrect")
Example #16
0
def test_field(fname, name, subdir):
    val = ut.verify_present(fname, "general/intracellular_ephys/"+subdir+"/", name.lower())
    if not ut.strcmp(val, name):
        ut.error("Checking metadata", "field value incorrect")
def test_field(fname, name, subdir):
    val = ut.verify_present(fname, "general/optogenetics/"+subdir+"/", name.lower())
    if not ut.strcmp(val, name):
        ut.error("Checking metadata", "field value incorrect")