Exemplo n.º 1
0
    def __init__(self, xml):
        super(AbsorbanceMultiRead, self).__init__(xml)

        xp = "//Section/Data?run:int=@Cycle/Well?well=@Pos/Multiple?location:well1=@MRW_Position&value=text()"

        self.alz = XPathAnalyzer(xp)
        self.alz.add_custom_type('well1', self.well1_fnc)

        self.result = self.wc.walk(self.alz)
Exemplo n.º 2
0
    def __init__(self, xml):
        super(AbsorbanceMultiRead, self).__init__(xml)

        xp = "//Section/Data?run:int=@Cycle/Well?well=@Pos/Multiple?location:well1=@MRW_Position&value=text()"

        self.alz = XPathAnalyzer(xp)
        self.alz.add_custom_type('well1', self.well1_fnc)

        self.result = self.wc.walk(self.alz)
Exemplo n.º 3
0
class AbsorbanceMultiRead(PlateRead):
    @staticmethod
    def well1_fnc(val):
        e = val.split(';')
        return e

    def __init__(self, xml):
        super(AbsorbanceMultiRead, self).__init__(xml)

        xp = "//Section/Data?run:int=@Cycle/Well?well=@Pos/Multiple?location:well1=@MRW_Position&value=text()"

        self.alz = XPathAnalyzer(xp)
        self.alz.add_custom_type('well1', self.well1_fnc)

        self.result = self.wc.walk(self.alz)

    def read(self):
        return
Exemplo n.º 4
0
class AbsorbanceMultiRead(PlateRead):
    @staticmethod
    def well1_fnc(val):
        e = val.split(';')
        return e

    def __init__(self, xml):
        super(AbsorbanceMultiRead, self).__init__(xml)

        xp = "//Section/Data?run:int=@Cycle/Well?well=@Pos/Multiple?location:well1=@MRW_Position&value=text()"

        self.alz = XPathAnalyzer(xp)
        self.alz.add_custom_type('well1', self.well1_fnc)

        self.result = self.wc.walk(self.alz)


    def read(self):
        return
Exemplo n.º 5
0
# print etree.tostring(o.xobj , pretty_print = True)

o2 = XMLBind(objectify.fromstring(template),
             namespaces={'ns': 'tecan.at.schema.documents'})

for key, value in o2.inspect(unique=True).iteritems():
    print key, ":", value

# Walker Test with namespace

wc = XMLWalker(root)
xp = "//ReadingFilter?type=@type"

result = wc.walk(
    XPathAnalyzer(xp, namespaces={'ns': 'tecan.at.schema.documents'}))

print len(result)
print result

# Walker Test without namespace

root = objectify.fromstring(etree.tostring(objectify.parse('gen.xml')))

wc = XMLWalker(root)
xp = "//Well?pos=@Pos/Scan?wave=@WL&val=text()"

result = wc.walk(XPathAnalyzer(xp))

print len(result)
print result[0]
Exemplo n.º 6
0
        'id_momentum': '/Id',
        'plate_height': '/Height',
        'plate_length': '/Length',
        'plate_width': '/Width',
        'stacking_plate_height': '/StackHeight',
        'plate_numbering': '/Numbering',
        'momentum_grip_force': '/GripForce'
    }

    a = '//PlateType?'
    a += '&'.join([
        key + "='" + value + "/text()'" if value[0] != '@' else key + "='" +
        value for key, value in definition.iteritems()
    ])

    plates = wk.walk(XPathAnalyzer(a))

    for plate in plates:
        c = Container(plate)
        c.store()

    infiles = glob.glob('imports/*.pdfx')

    for filename in infiles:
        s = etree.tostring(objectify.parse(filename), pretty_print=True)
        # s = string.replace(s, '\\', '/')
        #s = unicodedata.normalize("NFKD", s.encode('utf8'))
        s = s.encode('ascii', 'ignore').encode('latin-1')

        s = s.decode('utf-8', 'ignore')
        s = s.replace('®', '(R)')
Exemplo n.º 7
0
root = objectify.fromstring(
    etree.tostring(
        objectify.parse('E_PTT_BeamLocation_A12345678W_20140729_225738.xml')))

print etree.tostring(root, pretty_print=True)

# root.xpath('//Section/Data/Well/Multiple')
# root.xpath('//Section[@Name='Label1']/Data/Well/Multiple')
# root.xpath('//Section[@Name='Label1']/Data/Well/Multiple?pos=@MRW_Position')
# root.xpath('//Section[@Name='Label1']/Data/Well/Multiple/@MRW_Position')

wk = XMLWalker(root)
data = wk.walk(
    XPathAnalyzer(
        "//Section[@Name='Label1']/Data/Well?well=@Pos/Multiple?pos=@MRW_Position&value='/text()'"
    ))

print data

beams = {}

for d in data:
    p = d['pos'].split(';')
    if len(p) > 1:
        if d['well'] not in beams:
            beams[d['well']] = np.ones([15, 15]) * (-0.1)

        beams[d['well']][int(p[0]), int(p[1])] = float(d['value'])

grayscale = " .:-=+*#%@"