Exemplo n.º 1
0
    def __init__(self, part):
        """
        Constructs a Parser object for a specific read type in an infinite result .xml
        """

        self.xml = objectify.fromstring(etree.tostring(part))

        self.wc = XMLWalker(self.xml)
        self._wells = {}
Exemplo n.º 2
0
    def __init__(self, xml):
        """
        Constructs a Parser object for Infinite Result .xml
        """

        self.xml = objectify.fromstring(etree.tostring(xml))

        self.barcode = self.xml.xpath('/MeasurementResultData/Plate/BC/text()')
        self.sections = self.xml.xpath('/MeasurementResultData/Section')

        self.wc = XMLWalker(self.xml)

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

        pr = AbsorbanceMultiRead(self.sections[0])

        print pr.result
Exemplo n.º 3
0
# This actually calls the update
o.id = 1
# And show all ids
print o.id

# 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))
Exemplo n.º 4
0
# This actually calls the update
o.id = 1
# And show all ids
print o.id

# 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()"
Exemplo n.º 5
0
                else:
                    d['plate_rows'] = 0
                    d['plate_columns'] = 0

                del d['plate_wells']
                c = Container(d)
                c.store(d.keys())

    filename = 'imports/containerTypes.cfg.txt'
    s = etree.tostring(objectify.parse(filename), pretty_print=True)
    s = string.replace(s, '\\', '/')
    s = s.decode('unicode_escape').encode('ascii', 'ignore')

    root = objectify.fromstring(s)

    wk = XMLWalker(root)

    definition = {
        'general_id': '/Name',
        'general_name_short': '/Name',
        'general_name': '/Name',
        'general_description': '/Description',
        'general_image': '/ImagePath',
        'manufacturer_name': '/Manufacturer',
        'manufacturer_url': '/ManufacturerUrl',
        'manufacturer_number': '/PartNumber',
        'manufacturer_product_url': '/ProductInformationUrl',
        'id_momentum': '/Id',
        'plate_height': '/Height',
        'plate_length': '/Length',
        'plate_width': '/Width',
Exemplo n.º 6
0
                else:
                    d['plate_rows'] = 0
                    d['plate_columns'] = 0

                del d['plate_wells']
                c = Container(d)
                c.store(d.keys())

    filename = 'imports/containerTypes.cfg.txt'
    s = etree.tostring(objectify.parse(filename), pretty_print=True)
    s = string.replace(s, '\\', '/')
    s = s.decode('unicode_escape').encode('ascii', 'ignore')

    root = objectify.fromstring(s)

    wk = XMLWalker(root)

    definition = {
        'general_id': '/Name',
        'general_name_short': '/Name',
        'general_name': '/Name',
        'general_description': '/Description',
        'general_image': '/ImagePath',
        'manufacturer_name': '/Manufacturer',
        'manufacturer_url': '/ManufacturerUrl',
        'manufacturer_number': '/PartNumber',
        'manufacturer_product_url': '/ProductInformationUrl',
        'id_momentum': '/Id',
        'plate_height': '/Height',
        'plate_length': '/Length',
        'plate_width': '/Width',
Exemplo n.º 7
0
#s = db.get(files[2]['id'])

#root = objectify.fromstring(s, parser=None)

#root = objectify.parse('filename.xml')

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 = " .:-=+*#%@"
Exemplo n.º 8
0
#root = objectify.fromstring(s, parser=None)

#root = objectify.parse('filename.xml')

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)