当前位置: 首页>>代码示例>>Python>>正文


Python glob.glob1方法代码示例

本文整理汇总了Python中glob.glob1方法的典型用法代码示例。如果您正苦于以下问题:Python glob.glob1方法的具体用法?Python glob.glob1怎么用?Python glob.glob1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在glob的用法示例。


在下文中一共展示了glob.glob1方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: collect_room

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def collect_room(building_name, room_name):
  room_dir = os.path.join(DATA_DIR, 'Stanford3dDataset_v1.2', building_name,
                          room_name, 'Annotations')
  files = glob.glob1(room_dir, '*.txt')
  files = sorted(files, key=lambda s: s.lower())
  vertexs = []; colors = [];
  for f in files:
    file_name = os.path.join(room_dir, f)
    logging.info('  %s', file_name)
    a = np.loadtxt(file_name)
    vertex = a[:,:3]*1.
    color = a[:,3:]*1
    color = color.astype(np.uint8)
    vertexs.append(vertex)
    colors.append(color)
  files = [f.split('.')[0] for f in files]
  out = {'vertexs': vertexs, 'colors': colors, 'names': files}
  return out 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:20,代码来源:script_preprocess_annoations_S3DIS.py

示例2: have_similar_img

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def have_similar_img(base_img, comp_img_path, threshold=10):
    """
    Check whether comp_img_path have a image looks like base_img.
    """
    support_img_format = ['jpg', 'jpeg', 'gif', 'png', 'pmp']
    comp_images = []
    if os.path.isdir(comp_img_path):
        for ext in support_img_format:
            comp_images.extend([os.path.join(comp_img_path, x) for x in
                                glob.glob1(comp_img_path, '*.%s' % ext)])
    else:
        comp_images.append(comp_img_path)

    for img in comp_images:
        if img_similar(base_img, img, threshold):
            return True
    return False 
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:19,代码来源:ppm_utils.py

示例3: import_shapers

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def import_shapers(logger):
    (_, zip_path) = tempfile.mkstemp()
    (_, http_message) = request.urlretrieve(url, zip_path)
    zip_file = ZipFile(zip_path)
    ex_dir = tempfile.mkdtemp()
    zip_file.extractall(ex_dir)
    shapefiles = glob.glob1(ex_dir, "*.shp")
    lm = LayerMapping(Parcel, "/data/shapefiles/M274TaxPar.shp", {
        "shape_leng": "SHAPE_Leng",
        "shape_area": "SHAPE_Area",
        "map_par_id": "MAP_PAR_ID",
        "loc_id": "LOC_ID",
        "poly_type": "POLY_TYPE",
        "map_no": "MAP_NO",
        "source": "SOURCE",
        "plan_id": "PLAN_ID",
        "last_edit": "LAST_EDIT",
        "town_id": "TOWN_ID",
        "shape": "POLYGON"
    }) 
开发者ID:codeforboston,项目名称:cornerwise,代码行数:22,代码来源:cambridgema.py

示例4: table_water_level

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def table_water_level(lake, startdate, enddate, result_dir, output_file=None):
    # Grabs lake names from .txt files in the results folder.
    lakes = [i.split('.')[0] for i in glob.glob1(result_dir,'*txt')]

    # Compares lake names found from .txt files with the chosen lake. If a match is found, the parser is run.
    if lake in lakes:
        lake_dir = result_dir + os.sep + lake + '.txt'
        (features, dates, water, clouds) = parse_lake_results(lake_dir, startdate, enddate)

        # Error-catcher for situation where a date range is selected and no good points are available for plotting.
        if water == False:
            print "No good data points found in selected date range. Please try a larger date range and retry."
        # Table creating and saving block:
        else:
            # Error catching for invalid directories.
            if output_file == None:
                output_file = result_dir + '/' + lake + '.csv'
            with open(output_file, 'wb') as f:
                writer = csv.writer(f)
                writer.writerow(["Date", "Area (km^2)"])
                writer.writerows(izip(dates, water)) 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:23,代码来源:plot_water_levelui.py

示例5: plot_water_level

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def plot_water_level(lake, startdate, enddate, result_dir):
    # Grabs lake names from .txt files in the results folder.
    lakes = [i.split('.')[0] for i in glob.glob1(result_dir,'*txt')]

    # Compares lake names found from .txt files with the chosen lake. If a match is found, the parser is run.
    if lake in lakes:
        lake = result_dir + os.sep + lake + '.txt'
        (features, dates, water, clouds) = parse_lake_results(lake, startdate, enddate)

        # Error-catcher for situation where a date range is selected and no good points are available for plotting.
        if water == False:
            print "No good data points found in selected date range. Please try a larger date range."
        # plot_results(features, dates, water, clouds, None, 'results/mono_lake_elevation.txt')
        else:
            plot_results(features, dates, water, clouds)
            plt.show()

    # Notifies user if the data file for the selected lake has not been generated yet.
    else:
        print "Specified lake data file not found. Please retrieve data and try again." 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:22,代码来源:plot_water_levelui.py

示例6: checker

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def checker(folder, typ, infile, item, asset, start, end, cmin, cmax,outfile):
    print('Now Searching....')
    allasset = idl(infile = infile, item = item, asset = asset, start = start, end = end, cmin = cmin, cmax = cmax)
    sprefix = {'PSScene4Band': '_3B', 'REOrthoTile': '_R', 'PSScene3Band': '_3B', 'PSOrthoTile': '_BGRN'}
    sval = sprefix.get(item)
    if typ == 'image':
        filenames = glob.glob1(folder,"*.tif")
        l = []
        for items in filenames:
            l.append(items.split(sval)[0])
        print('Number of items not found locally: '+str(len(set(allasset)-set(l))))
        print('IDlist written to '+str(outfile)+' with '+str(len(set(allasset)-set(l))))
        with open(outfile, "w") as f:
            for s in list(set(allasset)-set(l)):
                f.write(str(s) +"\n")
    if typ=='metadata':
        filenames=glob.glob1(folder,"*.xml")
        l=[]
        for items in filenames:
            l.append(items.split(sval)[0])
        print('Number of items not found locally: '+str(len(set(allasset).difference(set(l)))))
        print('IDlist written to '+str(outfile)+' with '+str(len(set(allasset)-set(l)))+' ids')
        with open(outfile, "w") as f:
            for s in list(set(allasset)-set(l)):
                f.write(str(s) +"\n") 
开发者ID:tyson-swetnam,项目名称:porder,代码行数:27,代码来源:diffcheck.py

示例7: load_building_meshes

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def load_building_meshes(self, building):
    dir_name = os.path.join(building['data_dir'], 'mesh', building['name'])
    mesh_file_name = glob.glob1(dir_name, '*.obj')[0]
    mesh_file_name_full = os.path.join(dir_name, mesh_file_name)
    logging.error('Loading building from obj file: %s', mesh_file_name_full)
    shape = renderer.Shape(mesh_file_name_full, load_materials=True, 
                           name_prefix=building['name']+'_')
    return [shape] 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:10,代码来源:factory.py

示例8: _list_cache_files

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def _list_cache_files(self):
        """
        Get a list of paths to all the cache files. These are all the files
        in the root cache dir that end on the cache_suffix.
        """
        if not os.path.exists(self._dir):
            return []
        filelist = [os.path.join(self._dir, fname) for fname
                    in glob.glob1(self._dir, '*%s' % self.cache_suffix)]
        return filelist 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:12,代码来源:filebased.py

示例9: demo

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def demo():
	import glob
	winDir=win32api.GetWindowsDirectory()
	for fileName in glob.glob1(winDir, '*.bmp')[:2]:
		bitmapTemplate.OpenDocumentFile(os.path.join(winDir, fileName)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:bitmap.py

示例10: glob

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def glob(self, pattern, exclude = None):
        """Add a list of files to the current component as specified in the
        glob pattern. Individual files can be excluded in the exclude list."""
        files = glob.glob1(self.absolute, pattern)
        for f in files:
            if exclude and f in exclude: continue
            self.add_file(f)
        return files 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:__init__.py

示例11: run

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def run(logger=None):
    shapefiles_dir = download_shapefiles(shapefile_url, logger)

    try:
        shapefile = os.path.join(
            shapefiles_dir, glob.glob1(shapefiles_dir, "M274TaxPar.shp")[0])
        assessor_data = os.path.join(
            shapefiles_dir, glob.glob1(shapefiles_dir, "M274Assess.dbf")[0])
        import_shapes(shapefile, logger)
        add_assessor_data(assessor_data, logger)
    finally:
        shutil.rmtree(shapefiles_dir) 
开发者ID:codeforboston,项目名称:cornerwise,代码行数:14,代码来源:somervillema.py

示例12: get_new_file_name

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def get_new_file_name(path):
    video_counter = len(glob.glob1(path, "*.avi"))
    filename = "demo_%03d" % video_counter
    return path + time_stamped(filename) + ".avi" 
开发者ID:dronekit,项目名称:visual-followme,代码行数:6,代码来源:file_utils.py

示例13: max_globs

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def max_globs():
    for f in range(MAX_GLOBS):
        tmpfile = tempfile.NamedTemporaryFile(prefix='tmp_', suffix='_glob', delete=False)
        tmpfile.close()
        with open(tmpfile.name, 'w') as fd:
            fd.write(DATA)
    yield tempfile.gettempdir()
    for fle in glob.glob1(tempfile.gettempdir(), "tmp_*_glob"):
        os.remove(tempfile.gettempdir() + "/" + fle)


# hack to find this source file and not the .pyc version of it 
开发者ID:RedHatInsights,项目名称:insights-core,代码行数:14,代码来源:test_specs.py

示例14: pred_samples

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def pred_samples(runs_dir, data_dir, sess, image_shape, logits, keep_prob, input_image, print_speed=False):
    # Make folder for current run
    output_dir = os.path.join(runs_dir, str(time.time()))
    if os.path.exists(output_dir):
        shutil.rmtree(output_dir)
    os.makedirs(output_dir)

    # Run NN on test images and save them to HD
    print('Predicting images...')
    # start epoch training timer

    image_outputs = gen_output(
        sess, logits, keep_prob, input_image, data_dir, image_shape)

    counter = 0
    for name, image, speed_ in image_outputs:
        scipy.misc.imsave(os.path.join(output_dir, name), image)
        if print_speed is True:
            counter+=1
            print("Processing file: {0:05d},\tSpeed: {1:.2f} fps".format(counter, speed_))

        # sum_time += laptime

    # pngCounter = len(glob1(data_dir,'*.png'))

    print('All augmented images are saved to: {}.'.format(output_dir)) 
开发者ID:JunshengFu,项目名称:semantic_segmentation,代码行数:28,代码来源:helper.py

示例15: loadTif

# 需要导入模块: import glob [as 别名]
# 或者: from glob import glob1 [as 别名]
def loadTif(self):

        self.path = QtWidgets.QFileDialog.getExistingDirectory(
            self, "Select Directory"
        )
        if self.path:

            self.tifCounter = len(_glob.glob1(self.path, "*.tif"))
            self.tifFiles = _glob.glob(os.path.join(self.path, "*.tif"))

            self.table.setRowCount(int(self.tifCounter))
            self.table.setColumnCount(6)
            self.table.setHorizontalHeaderLabels(
                [
                    "FileName",
                    "Imager concentration[nM]",
                    "Integration time [ms]",
                    "Laserpower",
                    "Mean [Photons]",
                    "Std [Photons]",
                ]
            )

            for i in range(0, self.tifCounter):
                self.table.setItem(
                    i, 0, QtWidgets.QTableWidgetItem(self.tifFiles[i])
                ) 
开发者ID:jungmannlab,项目名称:picasso,代码行数:29,代码来源:simulate.py


注:本文中的glob.glob1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。