示例#1
0
文件: U.py 项目: QGB/QPSU
def shtml(txt,file='',browser=True):
	import T,pprint,F
	if file=='' and type(txt) is not str:
		try:file=T.filename(T.max(txt.__str__(),txt.__repr__(),txt.__name__)[:19])
		except:pass
	
	# if type(txt) in (dict,list):
	txt=pprint.pformat(txt)
		# if len(txt)==0:return
		# s=[]
		# for i in txt.keys():
			# s.append(T.string(i)+'   :   '+T.string(txt[i])+'\n')
		# txt=T.listToStr(s)
		# 
	if len(file)<1:file=T.filename(getObjName(txt)+stime())[:19]
	if not file.lower().endswith('.txt'):file+='.txt'
	F.write(file,txt)
	# f=open(file+'.txt','a')
	# rm(f.name)
	# txt=txt.replace(txthtml[1],txthtml[1][:1]+'!!!qgb-padding!!!'+txthtml[1][1:])	
	# f.write(txthtml[0])
	# f.write(txt)
	# f.write(txthtml[1])
	# f.close()
	if(browser==True):globals()['browser'](path.abspath(file))
示例#2
0
def project_tree():
    """
    Relation between topic and activity
    """
    form = SQLFORM.factory(
        Field('project_name',
              label=T('Project Name'),
              comment=T('Ingrese el nombre del proyecto'),
              requires=IS_IN_DB(db, 'projects.id', '%(name)s')),
        Field('process_file',
              'upload',
              label=T('Spreadsheet File'),
              comment=T('Ingresar archivo pre-formateado'),
              uploadfolder=UPLOAD_PATH))
    if form.process().accepted:
        projectname = form.vars.project_name
        filename = form.vars.process_file
        file_type = None
        if request.vars.process_file != '':
            file_type = request.vars.process_file.type
        if file_type == EXCEL_FILE or file_type == OLD_EXCEL_FILE:
            excel_process(filename, projectname)
            response.flash = 'Archivo Procesado!'
        else:
            response.flash = 'Archivo No Reconocido!'
    form2 = SQLFORM.grid(db.project_tree,
                         # create=False,
                         )
    return dict(form=form, form2=form2)
示例#3
0
文件: gdadin.py 项目: sahwar/gdadin
 def bbox_apply_mat(self, bbox, mat):
         A=[0,0]
         B=[0,0]
         A[0],A[1],B[0],B[1]=(bbox[0], bbox[2], bbox[1], bbox[3])
         T.applyTransformToPoint(mat, A)
         T.applyTransformToPoint(mat, B)
         return min(A[0], B[0]), max(A[0], B[0]), min(A[1], B[1]), max(A[1], B[1])
示例#4
0
文件: U.py 项目: QGB/QPSU
def helphtml(obj,*aos):
	txt=''
	import pydoc,re
	if aos:
		aos=flat(obj,aos,noNone=True)
		for i in aos:
			#TODO
			txt+=re.sub('.\b', '', pydoc.render_doc(i,'%s'))
			txt+='\n==============%s=======================\n'%ct(aos)
	else:txt=re.sub('.\b', '', pydoc.render_doc(obj,'%s'))
	# txt=txt.replace(txthtml[1],txthtml[1][:1]+'!!!qgb-padding!!!'+txthtml[1][1:])
	# txt=txthtml[0]+txt+txthtml[1]
	# msgbox(txt[txt.find(b'\x08'):])
	# repl()
	# exit()
	file='Uhelp_obj.txt'
	try:
		import T
		if obj:file=T.filename(getObjName(obj))+'.txt'
		elif aos:file=T.filename(getObjName(aos[0]))+'..%s.txt'%len(aos)
	except:pass
	

	with open(file,'w') as f:
		f.write(txt)
	# write(file,txt)
	globals()['browser'](file)
示例#5
0
文件: U.py 项目: QGB/QPSU
def cmd(*a):
	import T
	s=''
	if iswin():quot='"'
	if len(a)==0:
		if iswin():a=['cmd']
		# TODO #
	if len(a)==1:
		if type(a[0])==type(''):s=a[0]
		elif len(a[0])==1:s=T.string(a[0])
		elif len(a[0])>1:a=a[0]
	if len(a)>1:
		a=list(a)
		s=T.string(a.pop(0))+' '
		for i in a:
			if type(i)==type([]):
				for j in i:	
					s+=quot+T.string(i)+quot+' '
			else:
				s+=quot+T.string(i)+quot+' '
			
	# pln(s)
	# exit()
	try:
		return os.system(s)
	except:return -2
示例#6
0
文件: gdadin.py 项目: sahwar/gdadin
        def adjust_document_dim(self):
                bbox = T.computeBBox(self.render_groups)
                width = bbox[1] - bbox[0] + 100
                height = bbox[3] - bbox[2] + 100
                translateX = -bbox[0]+50
                translateY= -bbox[2]+50

                root = self.document.getroot()
                self.svg_setattr(root, 'width', str(width))
                self.svg_setattr(root, 'height', str(height))
                
                T.applyTransformToNode([[1,0,translateX],[0,1,translateY]], self.current_layer)
示例#7
0
 def sum(self, file):  #建立sum函数
     treader = T.txtReader()  #调用T类中的txtReader函数
     data = treader.parser(file)  #调用parser函数
     sum = 0
     for item in data:  #遍历data
         sum += int(item[0])  #累加item中的第一个整数
     print(sum)
示例#8
0
文件: gdadin.py 项目: sahwar/gdadin
        def _render_shape(self, id, node, shapename, rdata):
                #Note: `shapename' is not used
                if rdata['firstid'] == None: rdata['firstid'] = id

                ## Affine transform
                nmat = T.parseTransform(node.get('transform'))
                if rdata['mat']:
                        rdata['mat'] = T.composeTransform(rdata['mat'], nmat)
                        T.writeTransformToNode(rdata['mat'], node)
                else:
                        rdata['mat'] = nmat

                if self.check_shape_size(rdata['firstid'], rdata['mat']):
                        return #ok, let's stop

                self.foreach_subshape(node, self.call_shape, (rdata,))
示例#9
0
 def sum(self, file):
     treader = T.txtReader()
     data = treader.parser(file)
     sum = 0
     for item in data:
         sum += int(item[0])
     print(sum)
示例#10
0
文件: U.py 项目: QGB/QPSU
def calltimes(a=''):
	import T
	a='_count'+T.string(a)
	if calltimes.__dict__.has_key(a): 
		calltimes.__dict__[a]+=1
	else:
		calltimes.__dict__[a]=0
	return calltimes.__dict__[a]
示例#11
0
def topic_value(id_val):
    """
    Content Data Representation
    """
    try:
        val_topic = db.topics(id_val).name
    except:
        val_topic = T('ERROR: Inconsistency')
    return '%s' % val_topic
示例#12
0
def check_places(form):
    #place = form.vars.name
    #area = form.vars.area
    #data = db(db.places.name==place) & (db.places.area==area)).select()
    query = db.places.name == form.vars.name
    query &= db.places.area == form.vars.area
    if db(query).count():
        form.errors.user = T("Relation Between Place/Name already exists!")
    return
示例#13
0
文件: F.py 项目: QGB/QPSU
def name(a):
	'''Anti abs'''
	if U.inMuti(a,'/','\\',f=str.endswith):a=a[:-1]
	if not isAbs(a):return a
	else:
		
		a=T.sub(a,dir(a))
		# U.repl()
		if U.inMuti(a,'/','\\',f=str.startswith):return a[1:]
		else:return a
示例#14
0
 def avg(self, file):
     treader = T.txtReader()
     data = treader.parser(file)
     for item in data:
         sum = 0
         len = 0
         for item in data:
             sum += int(item[2])
             len += 1
             avg = sum / (len)
     print("avg=", avg)
示例#15
0
文件: U.py 项目: QGB/QPSU
def autohtml(file=None):
	import T
	if type(file)  is not str:
		if file is None:file=stime()+'.html'
		else:
			if hasattr(file,'__name__'):
				if '.htm' not in file.__name__:
					file=file.__name__+'.html'
			else:file='obj_{0}.html'.format(hash(file))
	elif  len(T.filename(file))<1:file=stime()+'.html'
	elif '.htm' not in file.lower():file=file+'.html'
	return file	
示例#16
0
 def sum(self, file):
     treader = T.txtReader()
     data = treader.parser(file)
     sum = 0
     line = 0
     for item in data:
         sum += int(item[0])
         line = line + 1
     print(sum)
     print(sum / line)
     run = sum / 5
     print(run)
示例#17
0
def answer_types():
    """
    Manage answer types
    """
    form = SQLFORM(db.answer_types)
    if form.process().accepted:
        response.flash = T('Answer Type Accepted')
    form2 = SQLFORM.grid(
        db.answer_types,
        create=False,
    )
    return dict(form=form, form2=form2)
示例#18
0
def tags():
    """
    Manage tags
    """
    form = SQLFORM(db.tag)
    if form.process().accepted:
        response.flash = T('Tag Accepted')
    form2 = SQLFORM.grid(
        db.tag,
        create=False,
    )
    return dict(form=form, form2=form2)
示例#19
0
def data_types():
    """
    Add Attachment Type
    """
    form = SQLFORM(db.data_types)
    if form.process().accepted:
        response.flash = T('Data Type Accepted')
    form2 = SQLFORM.grid(
        db.data_types,
        create=False,
    )
    return dict(form=form, form2=form2)
示例#20
0
def periods():
    """
    Period of Time
    """
    form = SQLFORM(db.periods)
    if form.process().accepted:
        response.flash = T('Period Accepted')
    form2 = SQLFORM.grid(
        db.periods,
        create=False,
    )
    return dict(form=form, form2=form2)
示例#21
0
文件: RT.py 项目: nexiakele/hello-
    def __init__(self):
        self.vgg_r = R.Model()
        self.vgg_t = T.Model()

        self.input_holder_r = tf.placeholder(tf.float32,
                                             [1, img_size, img_size, 3])
        self.input_holder_t = tf.placeholder(tf.float32,
                                             [1, img_size, img_size, 3])
        self.label_holder = tf.placeholder(tf.float32,
                                           [label_size * label_size, 2])
        self.label_holder2 = tf.placeholder(tf.float32, [88 * 88, 2])
        self.label_holder3 = tf.placeholder(tf.float32, [44 * 44, 2])
示例#22
0
def environments():
    """
    Kind of environment
    """
    form = SQLFORM(db.environments)
    if form.process().accepted:
        response.flash = T('Environment Accepted')
    form2 = SQLFORM.grid(
        db.environments,
        create=False,
    )
    return dict(form=form, form2=form2)
示例#23
0
文件: U.py 项目: QGB/QPSU
def main(display=True,pressKey=False,clipboard=False,escape=False,c=False,ipyOut=False,cmdPos=False,reload=False,*args):
	# print vars()
	# print stime()
	# exit()
	# shtml(vars(),file='vars0')
	anames=py.tuple([i for i in py.dir() if not i .startswith('args')])
	import T
	if not args:args=sys.argv
	
	for i in args:
		for j in anames:
			if i.lower().startswith(j.lower()+'='):
				# args.remove(i)
				i=T.sub(i,'=','').lower()
				if i.startswith('t'):exec j+'=True';break
				if i.startswith('f'):exec j+'=False';break
				
	# gsImport=gsImport.replace('\n','')
	# for i in getAllMod():
		# if gsImport.find(i)==-1:gsImport+=(','+i) 	
	##get coding line
	# for i in read(__file__).splitlines():
		# if i.startswith('#') and i.find('cod')!=-1:
			# gsImport=i+'\n'+gsImport
	# print vars()
	# exit()
	gsImport='''import sys,os;sys.path.append('{0}');from qgb import *'''.format(getModPathForImport())
	###############################
	'''call order Do Not Change! '''
	###############################
	if c:gsImport+=';C=c=U.c'
	
	if ipyOut:gsImport+=';O=o=U.ipyOutLast'
	
	if cmdPos:gsImport+=";POS=pos=U.cmdPos;npp=NPP=U.notePadPlus;ULS=Uls=uls=U.ls"
	
	if reload:gsImport+=";R=r=U.reload"
	
	if escape:gsImport=gsImport.replace("'",r"\'")
	
	if display:print gsImport
	
	if pressKey:
		try:
			import win32api
			win32api.ShellExecute(0, 'open', gsw+'exe/key.exe', gsImport+'\n','',0)
		except:print 'pressKey err'
	if clipboard:
		try:
			Clipboard.set(gsImport)
		except:print 'Clipboard err'
	
	return gsImport
示例#24
0
def projects():
    """
    Project: create or edit
    """
    form = SQLFORM(db.projects)
    if form.process().accepted:
        response.flash = T('Projects Accepted')
    form2 = SQLFORM.grid(
        db.projects,
        create=False,
    )
    return dict(form=form, form2=form2)
示例#25
0
    def handle(self, state, events):
        super().handle(state, events)

        immediate = state.stops[self.stop].parked_tram and state.stops[
            self.stop].parked_tram.capacity < C
        # Embark parked train, if it is already there
        if immediate:
            state.stops[self.stop].parked_tram.embark(1, self.stop)
            state.statistics.update_waiting(state, 0)
        # Wait at stop, otherwise
        else:
            state.stops[self.stop].enter(self.timestamp, state)

        # Schedule next passenger, if it is earlier than 10pm
        if self.timestamp.time < T('21:30:00').time:
            inter_time = round(gen_passenger_arrival(state, self.stop), 5)
            events.schedule(
                state,
                PassengerArrival(self.timestamp.shift(seconds=inter_time),
                                 self.stop))
示例#26
0
    def handle(self, state, events):
        super().handle(state, events)
        state.stops[self.stop].last_departure = self.timestamp
        next_stop = (self.stop + 1) % number_of_stops
        driving_time = 0 if end_arr(self.stop) else gen_driving_time(self.stop)
        events.schedule(
            state,
            Enqueue(self.timestamp.shift(seconds=driving_time),
                    tram=self.tram,
                    stop=next_stop))

        # Deque next tram
        if state.stops[self.stop].queue:
            next_tram = state.stops[self.stop].queue.popleft()
            if next_tram >= state.nt:
                import pdb
                pdb.set_trace()
            arrival_time = max(self.timestamp.time, state.timetable[self.stop].peek_schedule().time) \
                if end_dep(self.stop) else 0
            events.schedule(
                state, TramArrival(T(time=arrival_time), next_tram, self.stop))
示例#27
0
文件: U.py 项目: QGB/QPSU
def printAttr(a,console=False):
	'''aoto call __methods which is no args'''
	d=py.dir(a)
	
	if console:
		sk='%-{0}s'.format(maxLen(d))
		si='%-{0}s'.format(len(py.len(  d  )))
		for i,k in py.enumerate(d):
			print si%i,sk%k,py.eval('a.{0}'.format(k))
		return
		
	sh='''<tr>
	 <td>{0}</td>
	 <td id="n">{1}</td>
	 <td><textarea>{2}</textarea></td>
	 <td>{3}</td>
    </tr>'''
	sp=getModPath()+'file/attr.html'
	r='';v='';vi=-1
	for i,k in py.enumerate(d):
		try:
			v=py.eval('a.{0}'.format(k))
			vi=len(v)
			if py.callable(v) and k.startswith('__'):
				vv='!ErrGetV()'
				try:vv=v()
				except:pass
				v='{0} == {1}'.format(v,vv)
			
			if type(v) is not str:
				import pprint
				v= pprint.pformat(v)
		except Exception as e:v=py.repr(e)
		r+=sh.format(i,k,v,vi)
	# cdt('QPSU')
	import T
	name=gst+'QPSU/'+T.filename(getObjName(a))+'.html'
	write(name,read(sp).replace('{result}',r))
	browser(name)
示例#28
0
文件: U.py 项目: QGB/QPSU
def getVarName(a,funcName='getVarName'):
	'''funcName :defined for recursion frame search'''
	import inspect,re,T
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		r=T.sub(line,'(',')')
		if '(' not in r:
			return r
		# if funcName not in line:continue
		# line=T.sub(line,funcName,'').strip()
		# i0=line.find('(')
		# i1=line.find('(',i0+1)
		# if i1==0:return T.sub(line,'(',')').strip()
		# else:
		
		
		print repr(line)
		arr = []
		i=-1
		# repl()
		for c in line:
			i+=1				
			if c=='(':
				arr.append((i,c))
			elif c==')':
				if arr and arr[-1][1] == '(':
					il=arr.pop()[0]+1
					# ir is i
					print il,i,repr(line[il:i])
					if line.find(funcName,il,i)!=-1:
						il=il+line[il:i].find('(')+1 
						i =il+line[il:i].rfind(')')
						
						print repr(line[il:i].strip())
					else:
						pass
					# ra(i,c)
				else:
					return False
示例#29
0
    def __init__(self, nt, q, f, db, start=None):
        # Parameters
        self.pin_lambdas = deque(np.loadtxt('matlab/pin_lambdas.csv', delimiter=',').tolist())
        self.lambdas = None
        self.next_lambda()
        self.nt = nt
        self.q = q
        self.f = f
        self.db = db

        # State variables
        self.end_simulation = False
        pr_tt = Timetable(starts=[T('06:00:00'), T('07:04:00'), T('19:15:00')],
                          ends=[T('07:00:00'), T('19:00:00'), T('21:30:00')],
                          freqs=[offpeak_f, f, offpeak_f])
        self.timetable = {PR_DEP: pr_tt, CS_DEP: pr_tt.generate_other_direction((q + end_to_end_time) % f)}
        self.time = None
        self.statistics = Statistics(start)
        self.stops = [Stop(i) for i in range(number_of_stops)]
        self.trams = [Tram(i) for i in range(self.nt)]
        self.initial_trams = int(floor(self.nt / (offpeak_f/f)))
        if self.initial_trams % 2 != 0:
            self.initial_trams = ceil(self.initial_trams)
        self.switches = {'P+R': None, 'CS': None}
示例#30
0
文件: E.py 项目: myzsyweb/Casuistry
    return f()

##    def loadMacro(filename):#move to eval but limit
##        with open(filename) as f:
##            code = f.read()
##            start = 0
##            while 1:
##                t,end = peekSexp(code,start)
##                if end==-1:
##                    break
##                defmacro(code[start:end])
##                start = end 
##    loadMacro("initsyx.scm")

eval9(peekSexp('1')[0])
eval9(peekSexp('(::define a 1)')[0])
buildExp10(peekSexp('(::define a 1)')[0],Env())
defmacro(T.peekSexp("""(defmarco begin lst (cons '::begin lst))""")[0])
@block
def initMacro():
    Scm.load("initsyx.scm",topenvrn)
    Scm.load("quasiquote.scm",topenvrn)
    Scm.load("do.scm",topenvrn)
    Scm.load("initsyn2.scm",topenvrn)

###################################################################
topenvrn.define(Sym("apply"),BlkApp9())##
#define("apply",BlkApp9())
import P
P.makePrim(lambda k,v:topenvrn.define(k,v),topenvrn,Scm)
示例#31
0
                return wait

    def __str__(self):
        ret = "============ [{}] STATE ============\nTRAMS:\n".format(self.time)
        for tr in self.trams:
            ret += "\t{0}\n".format(str(tr))
        ret += "STOPS:\n"
        for st in self.stops:
            ret += "\t{}\n".format(str(st))
        try:
            ret += "TimetablePR: {}".format(self.timetable[PR_DEP].schedules[0])
        except IndexError:
            ret += "TimetablePR -"
        try:
            ret += "\nTimetableCS: {}".format(self.timetable[CS_DEP].schedules[0])
        except IndexError:
            ret += "\nTimetableCS -"
        return colored('blue', ret)


if __name__ == '__main__':
    timetable = Timetable(starts=[T('06:00:00'), T('07:04:00'), T('19:15:00')],
                          ends=[T('07:00:00'), T('19:00:00'), T('21:30:00')],
                          freqs=[15, 4, 15])
    timetable = {
        PR_DEP: str(timetable),
        CS_DEP: str(timetable.generate_other_direction((5 + 17) % 4))
    }
    import pprint
    pprint.pprint(timetable)
示例#32
0
STYLE = """
fillColor: '#AA00FF',
fillOpacity: .6,
strokeColor: '#000000',
strokeWidth: 1,
pointRadius: 8
"""

POPUP = '''"<div><strong>Nombre:</strong> <br/>" + feature.attributes.NOMBRE +
"<br/><strong>Categoria:</strong> <br/>" + feature.attributes.CATEGORIA +
"<br/><strong>Coordenadas:</strong> <br/>" + utmcoord +"</div>"'''

db.define_table('tag',
                Field('name',
                      label=T('Name'),
                      comment=T('Denominación del TAG')),
                format='%(name)s')

db.define_table('answer_types',
                Field('name', label=T('Name'), comment=T('Tipo de respuesta')),
                format='%(name)s')

db.define_table('data_types',
                Field('name', label=T('Name'), comment=T('Tipo de dato')),
                format='%(name)s')

db.define_table('gis_layers',
                Field('name', label=T('Name'), comment=T('Nombre de la capa')),
                Field('file_data',
                      label=T('File Data'),
示例#33
0
import numpy as np
import matplotlib.pyplot as plt
import time, mm, utils
import T as T

beads = []

circles = utils.HoughCircles(mm.Get(), 15, 30)
for c in circles:
    if (c[0] > 80 and c[0] < 680 and c[1] > 80 and c[1] < 500):
        beads.append(T.Bead(c[0], c[1]))

n = len(beads)
print(n, "Beads:", beads)

#T.test(beads, mm.Get())

x = np.arange(-2, 3)
y = 2 * x**2


def tiFitCenter(y0, y1, y2, y3, y4):
    a = (2 * y0 - y1 - 2 * y2 - y3 + 2 * y4) / 14
    b = -0.2 * y0 - 0.1 * y1 + 0.1 * y3 + 0.2 * y4
    return -b / a / 2


print(y)
print(tiFitCenter(y[0], y[1], y[2], y[3], y[4]))
示例#34
0
        sys.exit(2)
    file = sys.argv[1]
    try:
        fp = open(file, 'r')
        data = fp.read()
        fp.close()
    except IOError, msg:
        print file, ':', msg
        sys.exit(1)

    W, H = 600, 600
    gl.foreground()
    gl.prefsize(W, H)
    wid = gl.winopen('glwww')
    gl.color(GL.WHITE)
    gl.clear()
    gl.ortho2(0, W, H, 0)
    gl.color(GL.BLACK)
    T.TSTART()
    fmt = GLFormatter().init(5, 0, W - 5)
    p = html.FormattingParser().init(fmt, GLStylesheet)
    p.feed(data)
    p.close()
    T.TSTOP()
    gl.wintitle(p.title)
    import time
    time.sleep(5)


main()
示例#35
0
文件: gdadin.py 项目: sahwar/gdadin
 def compute_shape_bbox(self, id, node, shapename):
         self.shape_bbox[id] = T.computeBBox(node)
         return self.shape_bbox[id]
示例#36
0
文件: gdadin.py 项目: sahwar/gdadin
        def call_shape(self, rootnode, parentnode, childsname, childsnode, rdata):
                '''Inside `rootnode', substitute the `parentnode' with
                `childsnode', but keep the transformation attribute'''
               
                if not self.check_rdepth(parentnode):
                        return

                nrdata = dict(rdata)

                childid = self.svg_getattr(childsnode, 'id')
                if childid in self.rdepth_counter:
                        self.rdepth_counter[self.svg_getattr(childsnode, 'id')]+=1

                newchild = copy.deepcopy(childsnode)
                self.svg_setattr(newchild, 'id', self.newid(self.svg_prefixfromtag(childsnode.tag)))
                try:
                        self.svg_remattr(newchild, inkex.addNS('shape','gdadin'))
                        self.svg_remattr(newchild, 'transform')
                except:
                        pass
                #inkex.debug('calling ' + childsname + ' by ' + parentnode.get('id') +' in '+rootnode.get('id')+' newchild is '+newchild.get('id'))

                ### Calculate the various transformations.
                pmat = T.parseTransform(self.svg_getattr(parentnode, 'transform'))
                nrdata['mat'] = T.composeTransform(nrdata['mat'], pmat)

                ## Hue, Saturation, Brightness, Opacity
                try:
                        nrdata['hue']+=float(self.svg_getattr(parentnode, inkex.addNS('hue','gdadin')))
                        nrdata['sat']+=float(self.svg_getattr(parentnode, inkex.addNS('sat','gdadin')))
                        nrdata['bri']+=float(self.svg_getattr(parentnode, inkex.addNS('bri','gdadin')))
                        nrdata['opa']+=float(self.svg_getattr(parentnode, inkex.addNS('opa','gdadin')))
                        nrdata['hf'] = float(self.svg_getattr(parentnode, inkex.addNS('huefloor','gdadin')))
                        nrdata['hc'] = float(self.svg_getattr(parentnode, inkex.addNS('hueceil','gdadin')))
                        nrdata['sf'] = float(self.svg_getattr(parentnode, inkex.addNS('satfloor','gdadin')))
                        nrdata['sc'] = float(self.svg_getattr(parentnode, inkex.addNS('satceil','gdadin')))
                        nrdata['bf'] = float(self.svg_getattr(parentnode, inkex.addNS('brifloor','gdadin')))
                        nrdata['bc'] = float(self.svg_getattr(parentnode, inkex.addNS('briceil','gdadin')))
                        nrdata['of'] = float(self.svg_getattr(parentnode, inkex.addNS('opafloor','gdadin')))
                        nrdata['oc'] = float(self.svg_getattr(parentnode, inkex.addNS('opaceil','gdadin')))
                except:
                        pass
                ###

                if nrdata['hue'] or nrdata['sat'] or nrdata['bri'] or nrdata['opa']:
                        self.apply_hsbo(newchild, parentnode, nrdata)
                        hsbo = 1
                else:
                        hsbo = 0

                # xlinkify
                if not hsbo:
                        for sn in self.svg_subnodeslist(newchild):
                                if not self.svg_getattr(sn, inkex.addNS('shape','gdadin')):
                                        self.xlinkify(newchild, sn)

                self.svg_appendnode(rootnode.getparent(), newchild)
                if self.svg_getattr(rootnode, 'id') != nrdata['firstid']:
                        self.svg_remnode(parentnode)

                # Recurse!
                self.render_shape(None, newchild, None, nrdata)
示例#37
0
def execute1(temperature,tempFromTenths,dewpoint,dpFromTenths,windSpeed):
    TK = T.execute1(temperature,tempFromTenths) #Outputs Kelvin
    DpTK = DpT.execute4(dewpoint,dpFromTenths) #Outputs Kelvin
    wSpd = knotToMetersPS(windSpeed)

    return execute3(TK,DpTK,wSpd)
示例#38
0
for i in range(20):
    img = np.ndarray(shape)
    simulate.Generate(50, 50, 50 + i, 4, img)
    imgc.append(img)
img = np.ndarray(shape)
simulate.Generate(50, 50, 60, 4, img)

maxn = 20
loopRange = range(1, maxn)

if (True):
    ts = []
    for loop in loopRange:
        beads = []
        for i in range(loop):
            beads.append(T.Bead(50, 50))

        T.XY(beads, img)

        for i in range(20):
            T.Calibrate(beads, [imgc[i]], i)

        T.ComputeCalibration(beads)
        T.XYZ(beads, img)
        print(beads[0])

        start = time.time()
        for i in range(100):
            T.XYZ(beads, img)
        ts.append(time.time() - start)
示例#39
0
import numpy as np
import matplotlib.pyplot as plt
import time, mm, utils
import T as T

beads = []

xss = []
circles = utils.HoughCircles(mm.Get(), 15, 30)
for c in circles:
    if (c[0] > 80 and c[0] < 680 and c[1] > 80 and c[1] < 500):
        beads.append(T.Bead(c[0], c[1]))
        xss.append([])

n = len(beads)
print(n, "Beads:", beads)

T.XY(beads, mm.Get())

ts = []
start = time.time()
for loop in range(1000):
    img = mm.Get()
    ts.append(time.time() - start)
    T.XY(beads, img)
    for i in range(n):
        xss[i].append(beads[i].x)

print('time:', time.time() - start)
print('STD:', np.std(xss[0][10:] - np.mean(xss[1:], axis=0)[10:]))
plt.scatter(ts[10:], (xss[0] - np.mean(xss[1:], axis=0))[10:])
示例#40
0
def execute1(temperature, tempFromTenths, dewpoint, dpFromTenths, windSpeed):
    TK = T.execute1(temperature, tempFromTenths)  #Outputs Kelvin
    DpTK = DpT.execute4(dewpoint, dpFromTenths)  #Outputs Kelvin
    wSpd = knotToMetersPS(windSpeed)

    return execute3(TK, DpTK, wSpd)
示例#41
0
    elif i == 3:
        init_data('./data/data_lung', './data_read', 'data_lung')
    elif i == 4:
        init_data('./data/dataT', './data_read', 'dataT')
    print('data')

    if j == 0:
        f = open('./data_read/data_all', 'r')
        data_all = json.load(f)
        starting(data_all)
    elif j == 1:
        f = open('./data_read/data_all_1', 'r')
        data_all = json.load(f)
        csc(data_all)
    elif j == 2:
        f = open('./data_read/data_ys', 'r')
        data_all = json.load(f)
        ys = yangsen.YangSen(data_all)
        ys.yangSen_starting()
    elif j == 3:
        f = open('./data_read/data_lung', 'r')
        data_all = json.load(f)
        lung = lungcancer.LungCancer(data_all)
        lung.stages()
    elif j == 4:
        f = open('./data_read/dataT', 'r')
        data_all = json.load(f)
        t = T.T(data_all)
        t.driver()

    print('over')