예제 #1
0
    def test_open(self):

        for d in cdma.get_dataitems(self.g):
            print d

        #open a data group
        d = self.g["image#20"]["data"]
        for a in d.attrs:
            print a
예제 #2
0
    def test_open(self):
        
        for d in cdma.get_dataitems(self.g):
            print d

        #open a data group
        d = self.g["image#20"]["data"]
        for a in d.attrs:
            print a
예제 #3
0
파일: group_test.py 프로젝트: nhauser/cdma
    def test_iteration(self):
        
        g = self.rg["D1A_016_D1A"]
        self.assertTrue(g.short_name == "D1A_016_D1A")
        self.assertTrue(g.parent.short_name == "")
        self.assertTrue(g.root.short_name == "")

        #iterate over data items
        for d in cdma.get_dataitems(g):
            self.assertTrue(isinstance(d,cdma.DataItem))

        for g in cdma.get_groups(g):
            self.assertTrue(isinstance(g,cdma.Group))

        for d in cdma.get_dimensions(g):
            self.assertTrue(isinstance(d,cdma.Dimension))
예제 #4
0
    def test_iteration(self):

        g = self.rg["D1A_016_D1A"]
        self.assertTrue(g.short_name == "D1A_016_D1A")
        self.assertTrue(g.parent.short_name == "")
        self.assertTrue(g.root.short_name == "")

        #iterate over data items
        for d in cdma.get_dataitems(g):
            self.assertTrue(isinstance(d, cdma.DataItem))

        for g in cdma.get_groups(g):
            self.assertTrue(isinstance(g, cdma.Group))

        for d in cdma.get_dimensions(g):
            self.assertTrue(isinstance(d, cdma.Dimension))
예제 #5
0
import cdma

#open the dataset
print "open dataset ..."
ds = cdma.open_dataset("file:demo.nxs")

print "loop over all groups ..."
#iterate over all group below the root group
for g in ds.root_group:

    #iterate over all groups
    for group in cdma.get_groups(g):
        print group

    #iterate over all items
    for item in cdma.get_dataitems(g):
        print item

    #iterate over all dimensions
    for dimension in cdma.get_dimensions(g):
        print dimension

#get some basic information about the recorded data
g = ds.root_group["D1A_016_D1A"]
print g["experiment_identifier"][...]
print g["duration"][...]
print g["start_time"][...]
print g["end_time"][...]