@@ -48,16 +48,29 @@ class Subject(NWBContainer):
4848 'strain'
4949 )
5050
51- @docval ({'name' : 'age' , 'type' : str , 'doc' : 'the age of the subject' , 'default' : None },
52- {'name' : 'description' , 'type' : str , 'doc' : 'a description of the subject' , 'default' : None },
53- {'name' : 'genotype' , 'type' : str , 'doc' : 'the genotype of the subject' , 'default' : None },
54- {'name' : 'sex' , 'type' : str , 'doc' : 'the sex of the subject' , 'default' : None },
55- {'name' : 'species' , 'type' : str , 'doc' : 'the species of the subject' , 'default' : None },
56- {'name' : 'subject_id' , 'type' : str , 'doc' : 'a unique identifier for the subject' , 'default' : None },
57- {'name' : 'weight' , 'type' : str , 'doc' : 'the weight of the subject' , 'default' : None },
51+ @docval ({'name' : 'age' , 'type' : str ,
52+ 'doc' : ('The age of the subject. The ISO 8601 Duration format is recommended, e.g., "P90D" for '
53+ '90 days old.' ), 'default' : None },
54+ {'name' : 'description' , 'type' : str ,
55+ 'doc' : 'A description of the subject, e.g., "mouse A10".' , 'default' : None },
56+ {'name' : 'genotype' , 'type' : str ,
57+ 'doc' : 'The genotype of the subject, e.g., "Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt".' ,
58+ 'default' : None },
59+ {'name' : 'sex' , 'type' : str ,
60+ 'doc' : ('The sex of the subject. Using "F" (female), "M" (male), "U" (unknown), or "O" (other) '
61+ 'is recommended.' ), 'default' : None },
62+ {'name' : 'species' , 'type' : str ,
63+ 'doc' : ('The species of the subject. The formal latin binomal name is recommended, e.g., "Mus musculus"' ),
64+ 'default' : None },
65+ {'name' : 'subject_id' , 'type' : str , 'doc' : 'A unique identifier for the subject, e.g., "A10"' ,
66+ 'default' : None },
67+ {'name' : 'weight' , 'type' : (float , str ),
68+ 'doc' : ('The weight of the subject, including units. Using kilograms is recommended. e.g., "0.02 kg". '
69+ 'If a float is provided, then the weight will be stored as "[value] kg".' ),
70+ 'default' : None },
5871 {'name' : 'date_of_birth' , 'type' : datetime , 'default' : None ,
59- 'doc' : 'datetime of date of birth. May be supplied instead of age.' },
60- {'name' : 'strain' , 'type' : str , 'doc' : 'the strain of the subject' , 'default' : None })
72+ 'doc' : 'The datetime of the date of birth. May be supplied instead of age.' },
73+ {'name' : 'strain' , 'type' : str , 'doc' : 'The strain of the subject, e.g., "C57BL/6J" ' , 'default' : None })
6174 def __init__ (self , ** kwargs ):
6275 kwargs ['name' ] = 'subject'
6376 call_docval_func (super (Subject , self ).__init__ , kwargs )
@@ -67,7 +80,10 @@ def __init__(self, **kwargs):
6780 self .sex = getargs ('sex' , kwargs )
6881 self .species = getargs ('species' , kwargs )
6982 self .subject_id = getargs ('subject_id' , kwargs )
70- self .weight = getargs ('weight' , kwargs )
83+ weight = getargs ('weight' , kwargs )
84+ if isinstance (weight , float ):
85+ weight = str (weight ) + ' kg'
86+ self .weight = weight
7187 self .strain = getargs ('strain' , kwargs )
7288 date_of_birth = getargs ('date_of_birth' , kwargs )
7389 if date_of_birth and date_of_birth .tzinfo is None :
0 commit comments