コード例 #1
0
def xml(XMLDIR, seriesuid, spacing=None, origin=None):
    print XMLDIR
    scan = scn.Scan()
    scan.id = seriesuid
    xmlpath = XMLDIR + '/' + seriesuid + '.xml'
    print xmlpath
    try:
        xml = et.parse(xmlpath)
    except:
        return None
    ct = 0
    for reader in xml.findall('./{http://www.nih.gov}readingSession'):
        for reading in reader.findall(
                './{http://www.nih.gov}unblindedReadNodule'):
            nn = nd.Nodule()
            if reading.find(
                    './{http://www.nih.gov}characteristics') is not None:
                nn.type = 'L'
                characteristics = reading.find(
                    './{http://www.nih.gov}characteristics')
                nn.addCharacteristics(characteristics)
                for roi in reading.findall('./{http://www.nih.gov}roi'):
                    z = roi.find('./{http://www.nih.gov}imageZposition')
                    z = float(z.text)
                    z = z - origin[2]
                    oz = z / spacing[2]
                    include = roi.find('./{http://www.nih.gov}inclusion')
                    if include.text == 'TRUE':
                        for e in roi.findall('./{http://www.nih.gov}edgeMap'):
                            x = e.find('./{http://www.nih.gov}xCoord')
                            y = e.find('./{http://www.nih.gov}yCoord')
                            coord = int(x.text), int(y.text)
                            coord = (coord[0], coord[1], 0.)
                            coord *= spacing
                            coord[2] = z
                            nn.roi.append(coord)
                            nn.oroi.append((int(x.text), int(y.text), oz))
                nn.getProperties()
                scan.nodules.append(nn)
            #else:
            #  nn.type = 'S'
            #  nn.diameter = 3.
            #  roi = reading.find('./{http://www.nih.gov}roi')
            #  e = roi.find('./{http://www.nih.gov}edgeMap')
            #  x = e.find('./{http://www.nih.gov}xCoord')
            #  x = float(x.text)
            #  x *= spacing[0]
            #  y = e.find('./{http://www.nih.gov}yCoord')
            #  y = float(y.text)
            #  y *= spacing[1]
            #  z = roi.find('./{http://www.nih.gov}imageZposition')
            #  z = float(z.text)
            #  z = z-origin[2]
            #  nn.ox = x
            #  nn.oy = y
            #  nn.oz = z
            #  nn.centroid = (x,y,z)
            #  scan.nodules.append(nn)

    return scan
コード例 #2
0
ファイル: mt.py プロジェクト: elensar92/Marching-Methods
 def __init__(self, device, ctx, queue) :
     self.ctx = ctx 
     self.queue = queue
     with open('kernel/mt.cl', 'r') as fp : src = fp.read()
     #if "NVIDIA" == device.get_info(cl.device_info.VENDOR)[:6] :
     #    self.prg = cl.Program(self.ctx, src).build(options=["-cl-nv-verbose"], devices=[device,])
     #    print(self.prg.get_build_info(device=device, param=cl.program_build_info.LOG))
     #else :
     self.prg = cl.Program(self.ctx, src).build(devices=[device,])
     
     self.cscan = scan.Scan(self.ctx, self.queue)
     self.escan = scan.Scan(self.ctx, self.queue)
     self.nr_idx = np.zeros(1, dtype=np.int32)
     self.nr_vtx = np.zeros(1, dtype=np.int32)
     self.sz_idx = np.zeros(1, dtype=np.int32)
     self.sz_vtx = np.zeros(1, dtype=np.int32)
     self.evts = dict()
     self.mems = dict()
コード例 #3
0
def execute():
    epics.ca.initialize_libca(
    )  # force epics initialization prior to creating any threads
    scanner = scan.Scan()
    interupts.setup()

    # TODO: read config file/database and create alarm objects

    # Run forever until a shut down has been requested.
    #
    while not interupts.shutdown_requested():
        time.sleep(1.0)

    scanner.join()
    ca_alarm.ChannelAccessAlarm.join()
コード例 #4
0
    def _tar2md(self, tarchive, map_settings):
        """
        @param tarchive: the archive that will be extracted.
        @type tarchive: str
        @return mdobj
        ::note::
        WARNING: The md-object has to be re-initialized.
        """

        logger.debug('Unpacking to: %s.', os.getcwd())
        # UNIT: make sure there is only 1 executable in this folder
        logger.debug(str(os.listdir(os.getcwd())))

        # REQUEST AND WAIT FOR IO-TICKET
        self.comm.send('', self.root, tag=mpi.Tags.IO_REQUEST)
        self.comm.recv(source=self.root, tag=mpi.Tags.IO_TICKET)
        start = time.time()
        try:
            tarfile.open(tarchive).extractall()  # TODO: UNSAVE IF TARCHIVE $@!
            fsize = os.path.getsize(tarchive) / 1024 / 1024.  # TODO:Do in scan
        # RETURN TICKET. DO NOT FORGET 'FINALLY' IS FOR E.G. CASE OF IO-ERROR
        finally:
            self.comm.send('', dest=self.root, tag=mpi.Tags.IO_FINISHED)

        elapsed = time.time() - start

        log_speed(elapsed, fsize, self.archive)

        # TODO: scan for pdbfile(s) and or description
        topology, fepfile, inputfiles, self.steps, self.nanos = scan.Scan(
        ).scan()  # NOPEP8
        pdbfile = None
        description = None

        mdobj = trajectory.MolDynSim(self.tmp, self.exe, topology, inputfiles,
                                     fepfile, None, None, description, pdbfile,
                                     map_settings)
        return mdobj
コード例 #5
0
ファイル: comparechip.py プロジェクト: rgaior/singlecabac
print('signal to be ploted: ',signals)

for signal in signals:
    
    if signal in biases:
        types = ['bias']
        typeofsignal = 'bias'
    elif signal in clocks:
        types = ['rise','fall']
        typeofsignal = 'clock'
    for type in types:  
        xdata = np.array([])
        ydata = []
        plt.figure()
        for chip in chips:
            myscan = scan.Scan(signal, type, folder, chip, typeofsignal, 'test')
            myscan.getfiles()
            [a_x, a_y, a_rmsy] = myscan.extractcurve()
            xdata = a_x
            ydata.append(a_y)
            leg = type +' ' + signal.replace('_','') + ' chip = ' + str(chip)
            if typeofsignal == 'clock':
                plt.semilogy(a_x,a_y*1e9,'o',label=leg)
            if typeofsignal == 'bias':
                plt.plot(a_x,a_y,'o',label=leg)
            
        plt.xlabel('DAC unit')
        if typeofsignal== 'clock':
            plt.ylabel('time [ns]')
        if typeofsignal== 'bias':
            plt.ylabel('Output Voltage [V]')
コード例 #6
0
import os
import json
import scan

with open('config.json') as json_file:
    config = json.load(json_file)
    input_path = config["input path"]

paths = [x[0] for x in os.walk(input_path)]
paths = paths[1:]

for path in paths:
    project = scan.Scan(input_location=path, config=config)
コード例 #7
0
ファイル: scan_mining.py プロジェクト: aeraeg/data_assistant
import scan
import mining



scan_photo=scan.Scan(r'D:\2work\programing\1stleader\input\data\scan','w1.jpg',"test.xlsx")
table=scan.Scan(r'D:\programing\1stleader\input\data\scan\dts','1-Export-XPS.pdf',"tds.csv")
#for scan text 
#scan_photo.text_ar()
table.pdf_extract_table()



#tests
#scan_photo.hand_writing_digit()
#scan_photo.all_boxes()
#scan_photo.boxes()      #scan boinding box

#scan_photo.line_detection()
#scan_photo.spilt_cells_of_table()
#for scan 

#for select any image by your self
#scan_photo.select_box()

#scan_photo.decode_predictions()

import test
scan_photo_test=test.Scan(r'D:\2work\programing\1stleader\files\scan','test_numbers_en.JPG',"test.xlsx")

#scan_photo_test.text_en()
コード例 #8
0
#!/usr/bin/env python
import scan
import sys
filein = open(sys.argv[1]).readlines()
a = scan.Scan(filein)


def test():
    global token
    for i in range(100):
        if a.currentToken != "ENDFILE":
            token = a.getToken()
            printToken()
        else:
            break


token = ""


class treeNode():
    def __init__(self):
        self.data = None
        self.child0 = None
        self.child1 = None
        self.child2 = None
        self.sibling = None


class newStmtNode(treeNode):
    def __init__(self, kind):
コード例 #9
0
ファイル: main.py プロジェクト: matshono2113/posCheck_mats
import lora
import time
import sys
import scan

lr = lora.LoRa()
sc = scan.Scan()


def sendcmd(cmd):
    print(cmd)
    lr.write(cmd)
    time.sleep(0.2)
    print(lr.readline())


def setMode():
    lr.write('config\r\n')
    lr.s.flush()
    time.sleep(0.2)
    lr.reset()
    time.sleep(1.5)

    sendcmd('2\r\n')
    sendcmd('bw 3\r\n')
    sendcmd('sf 7\r\n')
    sendcmd('q 2\r\n')
    sendcmd('w\r\n')

    lr.reset()
    print('LoRa module set to new mode')
コード例 #10
0
                else:
                    printe(
                        "Invalid IP address {}, passing...".format(
                            line.strip()), "Validate IP")
                    pass
    elif arg.Domainlist:
        with open(arg.Domainlist) as Domainfile:
            for line in Domainfile.readlines():
                IPaddr, Domain = domain_check(arg.domain)
                IPS.append(IPaddr)
                DOMAINS.append(Domain)
    else:
        printe("No target given, exiting...", "Target")
        exit()

    try:
        socket.gethostbyaddr('8.8.8.8')
    except:
        printe('No Internet Access', 'Connection')
        exit()

    for IP in IPS:
        s = scan.Scan(IP=IP, Domain='', Settings=settings, arg=arg)
        s.scan_all()
        del s

    for domain in DOMAINS:
        d = scan.Scan(IP='', Domain=domain, Settings=settings, arg=arg)
        d.scan_all()
        del d