示例#1
0
def epitaxy_load_from_arrays(in_name, in_width, in_material, in_dos_layer,
                             in_pl_file):

    for i in range(0, len(in_width)):
        if isnumber(in_width[i]) == False:
            return False

    global epi

    epi = []

    for i in range(0, len(in_width)):

        a = epi_layer()

        a.name = in_name[i]

        a.width = float(in_width[i])
        a.mat_file = in_material[i]

        a.electrical_layer = in_dos_layer[i]  #value

        a.pl_file = in_pl_file[i]  #value

        epi.append(a)
        epitaxy_populate_rgb()

    return True
示例#2
0
文件: docreader.py 项目: OlafLee/DPLP
    def _parseline(self, line, gidx):
        """ Parse one line

        :type line: string
        :param line: one line from CoNLL-like format

        :type gidx: int
        :param gidx: global token index
        """
        items = line.strip().split('\t')
        tok = Token()
        tok.sidx, tok.tidx = int(items[0]), int(items[1])
        tok.word, tok.lemma = items[2], items[3]
        tok.pos, tok.deplabel = items[4], items[5]
        if isnumber(items[6]):
            tok.hidx = int(items[6])
        else:
            # No head word
            tok.hidx = None
        tok.ner = items[7]
        try:
            tok.partialparse = items[8]
        except IndexError:
            pass
        if len(items) == 10:
            tok.eduidx = int(items[9])
        elif (len(items) == 9) or (len(items) == 8):
            pass
        else:
            raise ValueError("Unrecognized format")
        tok.gidx = gidx
        return tok
示例#3
0
    def _parseline(self, line, gidx):
        """ Parse one line

        :type line: string
        :param line: one line from CoNLL-like format

        :type gidx: int
        :param gidx: global token index
        """
        items = line.strip().split('\t')
        tok = Token()
        tok.sidx, tok.tidx = int(items[0]), int(items[1])
        tok.word, tok.lemma = items[2], items[3]
        tok.pos, tok.deplabel = items[4], items[5]
        if isnumber(items[6]):
            tok.hidx = int(items[6])
        else:
            # No head word
            tok.hidx = None
        tok.ner = items[7]
        try:
            tok.partialparse = items[8]
        except IndexError:
            pass
        if len(items) == 10:
            tok.eduidx = int(items[9])
        elif (len(items) == 9) or (len(items) == 8):
            pass
        else:
            raise ValueError("Unrecognized format")
        tok.gidx = gidx
        return tok
示例#4
0
def print_cell(content, width, leftmargin=1):
    out(' ' * leftmargin)
    string = str(content)
    pad = (width - len(string)) * ' '
    if util.isnumber(content):
        out(pad + string)
    else:
        out(string + pad)
示例#5
0
def print_cell(content, width, leftmargin=1):
    out(' ' * leftmargin)
    string = str(content)
    pad = (width - len(string)) * ' '
    if util.isnumber(content):
        out(pad + string)
    else:
        out(string + pad)
def extract_height_in_cm(row):
    height = float(row['Height (cm)']) if util.isnumber(
        row['Height (cm)']) else 0

    log.debug('ID {} - Height = {} => {}'.format(row['PharmGKB Subject ID'],
                                                 row['Height (cm)'], height))

    # height in cm
    return height
def extract_weight_in_kg(row):
    # weight in kg
    weight = float(row['Weight (kg)']) if util.isnumber(
        row['Weight (kg)']) else 0

    log.debug('ID {} - Weight = {} => {}'.format(row['PharmGKB Subject ID'],
                                                 row['Weight (kg)'], weight))

    return weight
示例#8
0
def epitaxy_load_from_arrays(in_name,in_width,in_material,in_dos_layer,in_pl_file):

	for i in range(0, len(in_width)):
		if isnumber(in_width[i])==False:
			return False

	global layers
	global electrical_layers
	global width
	global mat_file
	global electrical_layer
	global pl_file
	global name

	layers=0
	electrical_layers=0
	width=[]
	mat_file=[]
	electrical_layer=[]
	pl_file=[]
	name=[]

	for i in range(0, len(in_width)):

		name.append(in_name[i])

		width.append(float(in_width[i]))

		mat_file.append(in_material[i])

		electrical_layer.append(in_dos_layer[i])		#value

		pl_file.append(in_pl_file[i])			#value

		if in_dos_layer[i].startswith("dos")==True:
			electrical_layers=electrical_layers+1


		layers=layers+1

	return True
示例#9
0
    if year is None:
        if year_based_task:
            help("년도가 지정되지 않았습니다: 'year' is missing value")
    else:
        if not year_based_task:
            print("경고: 외부로부터 데이터를 가져오지 않습니다. -year와 관련한 모든 인자값을 사용하지 않습니다.")
        else:
            if all_years:
                print("경고: 이미 모든 년도를 대상으로 지정하였습니다. -year 인자값이 무시되었습니다.")
            else:
                try:
                    sp = year.split('-')
                    for target in range(int(sp[0]), int(sp[1]) + 1):
                        list_year.append(target)
                except:
                    if util.isnumber(year):
                        list_year.append(int(year))
                    else:
                        help('올바르지 않은 연도 값입니다.')

    # MITRE 컨텐츠를 이용합니까?
    # if content_type == 'mitre' and len(list_year) != 0:
    #     print("경고: mitre 리스트에서는 연도 별로 구분하지 않습니다. -year와 관련한 모든 인자값을 사용하지 않습니다.")

    # CSV 파일 출력 여부
    if csv_output:
        output_filetype.append(export_file.get("--csv"))

    # SQL 파일 출력 여부 (DB)
    if sql_output:
        output_filetype.append(export_file.get('--db'))
示例#10
0
def draw_rays(ray_file, top, width, y_mul, w):
    global ray_fast
    d = ray_fast

    if fast_load(d, ray_file) == True:
        if len(d.out) > 2:
            head, tail = os.path.split(ray_file)
            out = d.out
            m = d.m
            std = d.std

            #for i in range(0,len(out)):
            #	print(out[i].x,out[i].x)
            #print(ray_file)
            glLineWidth(2)
            num = tail[10:-4]
            if isnumber(num) == False:
                #print("not a number")
                return

            if std == 0.0:
                #print("std is zero")
                return

            wavelength = float(num)
            r, g, b = wavelength_to_rgb(wavelength)

            glColor4f(r, g, b, 0.5)
            glBegin(GL_QUADS)

            sub = epitaxy_get_device_start()
            s = 0
            mm = 0

            std_mul = 0.05
            #print(len(d.out))
            #print(d.m)
            #print(d.std)
            x_mul = width / (std * std_mul)
            i = 0
            #step=((int)(len(out)/6000))*2
            #if step<2:
            step = 2

            while (i < len(out) - 2):
                if fabs(out[i].x - m) < std * std_mul:
                    if fabs(out[i + 1].x - m) < std * std_mul:
                        #print(sub)
                        glVertex3f(width / 2 + (out[i].x - m) * x_mul,
                                   top - (out[i].y + sub) * y_mul, 0)
                        glVertex3f(width / 2 + (out[i + 1].x - m) * x_mul,
                                   top - (out[i + 1].y + sub) * y_mul, 0)

                        glVertex3f(width / 2 + (out[i + 1].x - m) * x_mul,
                                   top - (out[i + 1].y + sub) * y_mul, w)
                        glVertex3f(width / 2 + (out[i].x - m) * x_mul,
                                   top - (out[i].y + sub) * y_mul, w)

                i = i + step

            glEnd()