_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q269900 | Biomart.get_datasets | test | def get_datasets(self, mart='ENSEMBL_MART_ENSEMBL'):
"""Get available datasets from mart you've selected"""
datasets = self.datasets(mart, raw=True)
return pd.read_csv(StringIO(datasets), header=None, usecols=[1, 2],
names = ["Name", "Description"],sep="\t") | python | {
"resource": ""
} |
q269901 | Biomart.get_attributes | test | def get_attributes(self, dataset):
"""Get available attritbutes from dataset you've selected"""
attributes = self.attributes(dataset)
attr_ = [ (k, v[0]) for k, v in attributes.items()]
return pd.DataFrame(attr_, columns=["Attribute","Description"]) | python | {
"resource": ""
} |
q269902 | Biomart.get_filters | test | def get_filters(self, dataset):
"""Get available filters from dataset you've selected"""
filters = self.filters(dataset)
filt_ = [ (k, v[0]) for k, v in filters.items()]
return pd.DataFrame(filt_, columns=["Filter", "Description"]) | python | {
"resource": ""
} |
q269903 | Biomart.query | test | def query(self, dataset='hsapiens_gene_ensembl', attributes=[],
filters={}, filename=None):
"""mapping ids using BioMart.
:param dataset: str, default: 'hsapiens_gene_ensembl'
:param attributes: str, list, tuple
:param filters: dict, {'filter name': list(filter value)}
... | python | {
"resource": ""
} |
q269904 | gsea | test | def gsea(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000,
weighted_score_type=1,permutation_type='gene_set', method='log2_ratio_of_classes',
ascending=False, processes=1, figsize=(6.5,6), format='pdf',
graph_num=20, no_plot=False, seed=None, verbose=False... | python | {
"resource": ""
} |
q269905 | ssgsea | test | def ssgsea(data, gene_sets, outdir="ssGSEA_", sample_norm_method='rank', min_size=15, max_size=2000,
permutation_num=0, weighted_score_type=0.25, scale=True, ascending=False, processes=1,
figsize=(7,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False):
"""Run Gene Set Enric... | python | {
"resource": ""
} |
q269906 | prerank | test | def prerank(rnk, gene_sets, outdir='GSEA_Prerank', pheno_pos='Pos', pheno_neg='Neg',
min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1,
ascending=False, processes=1, figsize=(6.5,6), format='pdf',
graph_num=20, no_plot=False, seed=None, verbose=False):
""" Ru... | python | {
"resource": ""
} |
q269907 | replot | test | def replot(indir, outdir='GSEA_Replot', weighted_score_type=1,
min_size=3, max_size=1000, figsize=(6.5,6), graph_num=20, format='pdf', verbose=False):
"""The main function to reproduce GSEA desktop outputs.
:param indir: GSEA desktop results directory. In the sub folder, you must contain edb file fo... | python | {
"resource": ""
} |
q269908 | GSEAbase._set_cores | test | def _set_cores(self):
"""set cpu numbers to be used"""
cpu_num = cpu_count()-1
if self._processes > cpu_num:
cores = cpu_num
elif self._processes < 1:
cores = 1
else:
cores = self._processes
# have to be int if user input is float
... | python | {
"resource": ""
} |
q269909 | GSEAbase.load_gmt | test | def load_gmt(self, gene_list, gmt):
"""load gene set dict"""
if isinstance(gmt, dict):
genesets_dict = gmt
elif isinstance(gmt, str):
genesets_dict = self.parse_gmt(gmt)
else:
raise Exception("Error parsing gmt parameter for gene sets")
... | python | {
"resource": ""
} |
q269910 | GSEAbase.get_libraries | test | def get_libraries(self, database=''):
"""return active enrichr library name.Offical API """
lib_url='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%database
libs_json = json.loads(requests.get(lib_url).text)
libs = [lib['libraryName'] for lib in libs_json['statistics']]
... | python | {
"resource": ""
} |
q269911 | GSEAbase._download_libraries | test | def _download_libraries(self, libname):
""" download enrichr libraries."""
self._logger.info("Downloading and generating Enrichr library gene sets......")
s = retry(5)
# queery string
ENRICHR_URL = 'http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary'
query_string = '?mode=t... | python | {
"resource": ""
} |
q269912 | GSEAbase._heatmat | test | def _heatmat(self, df, classes, pheno_pos, pheno_neg):
"""only use for gsea heatmap"""
width = len(classes) if len(classes) >= 6 else 5
cls_booA =list(map(lambda x: True if x == pheno_pos else False, classes))
cls_booB =list(map(lambda x: True if x == pheno_neg else False, classes))
... | python | {
"resource": ""
} |
q269913 | GSEAbase._save_results | test | def _save_results(self, zipdata, outdir, module, gmt, rank_metric, permutation_type):
"""reformat gsea results, and save to txt"""
res = OrderedDict()
for gs, gseale, ind, RES in zipdata:
rdict = OrderedDict()
rdict['es'] = gseale[0]
rdict['nes'] = gseale[1]
... | python | {
"resource": ""
} |
q269914 | GSEA.load_data | test | def load_data(self, cls_vec):
"""pre-processed the data frame.new filtering methods will be implement here.
"""
# read data in
if isinstance(self.data, pd.DataFrame) :
exprs = self.data.copy()
# handle index is gene_names
if exprs.index.dtype == 'O':
... | python | {
"resource": ""
} |
q269915 | GSEA.run | test | def run(self):
"""GSEA main procedure"""
assert self.permutation_type in ["phenotype", "gene_set"]
assert self.min_size <= self.max_size
# Start Analysis
self._logger.info("Parsing data files for GSEA.............................")
# phenotype labels parsing
phe... | python | {
"resource": ""
} |
q269916 | Prerank.run | test | def run(self):
"""GSEA prerank workflow"""
assert self.min_size <= self.max_size
# parsing rankings
dat2 = self._load_ranking(self.rnk)
assert len(dat2) > 1
# cpu numbers
self._set_cores()
# Start Analysis
self._logger.info("Parsing data files f... | python | {
"resource": ""
} |
q269917 | SingleSampleGSEA.runSamplesPermu | test | def runSamplesPermu(self, df, gmt=None):
"""Single Sample GSEA workflow with permutation procedure"""
assert self.min_size <= self.max_size
mkdirs(self.outdir)
self.resultsOnSamples = OrderedDict()
outdir = self.outdir
# iter throught each sample
for name, ser in... | python | {
"resource": ""
} |
q269918 | SingleSampleGSEA.runSamples | test | def runSamples(self, df, gmt=None):
"""Single Sample GSEA workflow.
multiprocessing utility on samples.
"""
# df.index.values are gene_names
# Save each sample results to odict
self.resultsOnSamples = OrderedDict()
outdir = self.outdir
# run ssgsea for... | python | {
"resource": ""
} |
q269919 | SingleSampleGSEA._save | test | def _save(self, outdir):
"""save es and stats"""
# save raw ES to one csv file
samplesRawES = pd.DataFrame(self.resultsOnSamples)
samplesRawES.index.name = 'Term|ES'
# normalize enrichment scores by using the entire data set, as indicated
# by Barbie et al., 2009, online ... | python | {
"resource": ""
} |
q269920 | Replot.run | test | def run(self):
"""main replot function"""
assert self.min_size <= self.max_size
assert self.fignum > 0
import glob
from bs4 import BeautifulSoup
# parsing files.......
try:
results_path = glob.glob(self.indir+'*/edb/results.edb')[0]
rank_p... | python | {
"resource": ""
} |
q269921 | enrichr | test | def enrichr(gene_list, gene_sets, organism='human', description='',
outdir='Enrichr', background='hsapiens_gene_ensembl', cutoff=0.05,
format='pdf', figsize=(8,6), top_term=10, no_plot=False, verbose=False):
"""Enrichr API.
:param gene_list: Flat file with list of genes, one gene id per... | python | {
"resource": ""
} |
q269922 | Enrichr.parse_genesets | test | def parse_genesets(self):
"""parse gene_sets input file type"""
enrichr_library = self.get_libraries()
if isinstance(self.gene_sets, list):
gss = self.gene_sets
elif isinstance(self.gene_sets, str):
gss = [ g.strip() for g in self.gene_sets.strip().split(",") ]
... | python | {
"resource": ""
} |
q269923 | Enrichr.parse_genelists | test | def parse_genelists(self):
"""parse gene list"""
if isinstance(self.gene_list, list):
genes = self.gene_list
elif isinstance(self.gene_list, pd.DataFrame):
# input type is bed file
if self.gene_list.shape[1] >=3:
genes= self.gene_list.iloc[:,:3... | python | {
"resource": ""
} |
q269924 | Enrichr.send_genes | test | def send_genes(self, gene_list, url):
""" send gene list to enrichr server"""
payload = {
'list': (None, gene_list),
'description': (None, self.descriptions)
}
# response
response = requests.post(url, files=payload)
if not response.ok:
r... | python | {
"resource": ""
} |
q269925 | Enrichr.check_genes | test | def check_genes(self, gene_list, usr_list_id):
'''
Compare the genes sent and received to get successfully recognized genes
'''
response = requests.get('http://amp.pharm.mssm.edu/Enrichr/view?userListId=%s' % usr_list_id)
if not response.ok:
raise Exception('Error get... | python | {
"resource": ""
} |
q269926 | Enrichr.get_background | test | def get_background(self):
"""get background gene"""
# input is a file
if os.path.isfile(self.background):
with open(self.background) as b:
bg2 = b.readlines()
bg = [g.strip() for g in bg2]
return set(bg)
# package included ... | python | {
"resource": ""
} |
q269927 | Enrichr.run | test | def run(self):
"""run enrichr for one sample gene list but multi-libraries"""
# set organism
self.get_organism()
# read input file
genes_list = self.parse_genelists()
gss = self.parse_genesets()
# if gmt
self._logger.info("Connecting to Enrichr Server to ... | python | {
"resource": ""
} |
q269928 | cube | test | def cube(script, size=1.0, center=False, color=None):
"""Create a cube primitive
Note that this is made of 6 quads, not triangles
"""
"""# Convert size to list if it isn't already
if not isinstance(size, list):
size = list(size)
# If a single value was supplied use it for all 3 axes
... | python | {
"resource": ""
} |
q269929 | icosphere | test | def icosphere(script, radius=1.0, diameter=None, subdivisions=3, color=None):
"""create an icosphere mesh
radius Radius of the sphere
# subdivisions = Subdivision level; Number of the recursive subdivision of the
# surface. Default is 3 (a sphere approximation composed by 1280 faces).
# Admitted va... | python | {
"resource": ""
} |
q269930 | torus | test | def torus(script, major_radius=3.0, minor_radius=1.0, inner_diameter=None,
outer_diameter=None, major_segments=48, minor_segments=12,
color=None):
"""Create a torus mesh
Args:
major_radius (float, (optional)): radius from the origin to the
center of the cross sections
... | python | {
"resource": ""
} |
q269931 | plane_hires_edges | test | def plane_hires_edges(script, size=1.0, x_segments=1, y_segments=1,
center=False, color=None):
""" Creates a plane with a specified number of vertices
on it sides, but no vertices on the interior.
Currently used to create a simpler bottom for cube_hires.
"""
size = util.make_... | python | {
"resource": ""
} |
q269932 | cube_hires | test | def cube_hires(script, size=1.0, x_segments=1, y_segments=1, z_segments=1,
simple_bottom=True, center=False, color=None):
"""Create a box with user defined number of segments in each direction.
Grid spacing is the same as its dimensions (spacing = 1) and its
thickness is one. Intended to be ... | python | {
"resource": ""
} |
q269933 | color_values | test | def color_values(color):
"""Read color_names.txt and find the red, green, and blue values
for a named color.
"""
# Get the directory where this script file is located:
this_dir = os.path.dirname(
os.path.realpath(
inspect.getsourcefile(
lambda: 0)))
color_... | python | {
"resource": ""
} |
q269934 | check_list | test | def check_list(var, num_terms):
""" Check if a variable is a list and is the correct length.
If variable is not a list it will make it a list of the correct length with
all terms identical.
"""
if not isinstance(var, list):
if isinstance(var, tuple):
var = list(var)
else... | python | {
"resource": ""
} |
q269935 | make_list | test | def make_list(var, num_terms=1):
""" Make a variable a list if it is not already
If variable is not a list it will make it a list of the correct length with
all terms identical.
"""
if not isinstance(var, list):
if isinstance(var, tuple):
var = list(var)
else:
... | python | {
"resource": ""
} |
q269936 | write_filter | test | def write_filter(script, filter_xml):
""" Write filter to FilterScript object or filename
Args:
script (FilterScript object or filename str): the FilterScript object
or script filename to write the filter to.
filter_xml (str): the xml filter string
"""
if isinstance(script,... | python | {
"resource": ""
} |
q269937 | ls3loop | test | def ls3loop(script, iterations=1, loop_weight=0, edge_threshold=0,
selected=False):
""" Apply LS3 Subdivision Surface algorithm using Loop's weights.
This refinement method take normals into account.
See: Boye', S. Guennebaud, G. & Schlick, C.
"Least squares subdivision surfaces"
Comput... | python | {
"resource": ""
} |
q269938 | merge_vert | test | def merge_vert(script, threshold=0.0):
""" Merge together all the vertices that are nearer than the specified
threshold. Like a unify duplicate vertices but with some tolerance.
Args:
script: the FilterScript object or script filename to write
the filter to.
threshold (float): M... | python | {
"resource": ""
} |
q269939 | close_holes | test | def close_holes(script, hole_max_edge=30, selected=False,
sel_new_face=True, self_intersection=True):
""" Close holes smaller than a given threshold
Args:
script: the FilterScript object or script filename to write
the filter to.
hole_max_edge (int): The size is expr... | python | {
"resource": ""
} |
q269940 | split_vert_on_nonmanifold_face | test | def split_vert_on_nonmanifold_face(script, vert_displacement_ratio=0.0):
""" Split non-manifold vertices until it becomes two-manifold.
Args:
script: the FilterScript object or script filename to write
the filter to.
vert_displacement_ratio (float): When a vertex is split it is move... | python | {
"resource": ""
} |
q269941 | snap_mismatched_borders | test | def snap_mismatched_borders(script, edge_dist_ratio=0.01, unify_vert=True):
""" Try to snap together adjacent borders that are slightly mismatched.
This situation can happen on badly triangulated adjacent patches defined by
high order surfaces. For each border vertex the filter snaps it onto the
closes... | python | {
"resource": ""
} |
q269942 | translate | test | def translate(script, value=(0.0, 0.0, 0.0)):
"""An alternative translate implementation that uses a geometric function.
This is more accurate than the built-in version."""
# Convert value to list if it isn't already
if not isinstance(value, list):
value = list(value)
vert_function(script,
... | python | {
"resource": ""
} |
q269943 | rotate | test | def rotate(script, axis='z', angle=0.0):
"""An alternative rotate implementation that uses a geometric function.
This is more accurate than the built-in version."""
angle = math.radians(angle)
if axis.lower() == 'x':
vert_function(script,
x_func='x',
y_func='y*c... | python | {
"resource": ""
} |
q269944 | scale | test | def scale(script, value=1.0):
"""An alternative scale implementation that uses a geometric function.
This is more accurate than the built-in version."""
"""# Convert value to list if it isn't already
if not isinstance(value, list):
value = list(value)
# If a single value was supplied use it ... | python | {
"resource": ""
} |
q269945 | function_cyl_co | test | def function_cyl_co(script, r_func='r', theta_func='theta', z_func='z'):
"""Geometric function using cylindrical coordinates.
Define functions in Z up cylindrical coordinates, with radius 'r',
angle 'theta', and height 'z'
See "function" docs for additional usage info and accepted parameters.
Arg... | python | {
"resource": ""
} |
q269946 | wrap2cylinder | test | def wrap2cylinder(script, radius=1, pitch=0, taper=0, pitch_func=None,
taper_func=None):
"""Deform mesh around cylinder of radius and axis z
y = 0 will be on the surface of radius "radius"
pitch != 0 will create a helix, with distance "pitch" traveled in z for each rotation
taper = ch... | python | {
"resource": ""
} |
q269947 | bend | test | def bend(script, radius=1, pitch=0, taper=0, angle=0, straght_start=True,
straght_end=False, radius_limit=None, outside_limit_end=True):
"""Bends mesh around cylinder of radius radius and axis z to a certain angle
straight_ends: Only apply twist (pitch) over the area that is bent
outside_limit_en... | python | {
"resource": ""
} |
q269948 | deform2curve | test | def deform2curve(script, curve=mp_func.torus_knot('t'), step=0.001):
""" Deform a mesh along a parametric curve function
Provide a parametric curve function with z as the parameter. This will
deform the xy cross section of the mesh along the curve as z increases.
Source: http://blackpawn.com/texts/pqt... | python | {
"resource": ""
} |
q269949 | vc2tex | test | def vc2tex(script, tex_name='TEMP3D_texture.png', tex_width=1024,
tex_height=1024, overwrite_tex=False, assign_tex=False,
fill_tex=True):
"""Transfer vertex colors to texture colors
Args:
script: the FilterScript object or script filename to write
the filter to.
... | python | {
"resource": ""
} |
q269950 | mesh2fc | test | def mesh2fc(script, all_visible_layers=False):
"""Transfer mesh colors to face colors
Args:
script: the FilterScript object or script filename to write
the filter to.
all_visible_layers (bool): If true the color mapping is applied to all the meshes
"""
filter_xml = ''.join([... | python | {
"resource": ""
} |
q269951 | uniform_resampling | test | def uniform_resampling(script, voxel=1.0, offset=0.0, merge_vert=True,
discretize=False, multisample=False, thicken=False):
""" Create a new mesh that is a resampled version of the current one.
The resampling is done by building a uniform volumetric representation
where each voxel co... | python | {
"resource": ""
} |
q269952 | surface_poisson_screened | test | def surface_poisson_screened(script, visible_layer=False, depth=8,
full_depth=5, cg_depth=0, scale=1.1,
samples_per_node=1.5, point_weight=4.0,
iterations=8, confidence=False, pre_clean=False):
""" This surface reconstruction alg... | python | {
"resource": ""
} |
q269953 | voronoi | test | def voronoi(script, hole_num=50, target_layer=None, sample_layer=None, thickness=0.5, backward=True):
""" Turn a model into a surface with Voronoi style holes in it
References:
http://meshlabstuff.blogspot.com/2009/03/creating-voronoi-sphere.html
http://meshlabstuff.blogspot.com/2009/04/creating-vorono... | python | {
"resource": ""
} |
q269954 | all | test | def all(script, face=True, vert=True):
""" Select all the faces of the current mesh
Args:
script: the FilterScript object or script filename to write
the filter to.
faces (bool): If True the filter will select all the faces.
verts (bool): If True the filter will select all t... | python | {
"resource": ""
} |
q269955 | vert_quality | test | def vert_quality(script, min_quality=0.0, max_quality=0.05, inclusive=True):
""" Select all the faces and vertexes within the specified vertex quality
range.
Args:
script: the FilterScript object or script filename to write
the filter] to.
min_quality (float): Minimum accept... | python | {
"resource": ""
} |
q269956 | face_function | test | def face_function(script, function='(fi == 0)'):
"""Boolean function using muparser lib to perform face selection over
current mesh.
See help(mlx.muparser_ref) for muparser reference documentation.
It's possible to use parenthesis, per-vertex variables and boolean operator:
(, ), and, or, ... | python | {
"resource": ""
} |
q269957 | vert_function | test | def vert_function(script, function='(q < 0)', strict_face_select=True):
"""Boolean function using muparser lib to perform vertex selection over current mesh.
See help(mlx.muparser_ref) for muparser reference documentation.
It's possible to use parenthesis, per-vertex variables and boolean operator:
... | python | {
"resource": ""
} |
q269958 | cylindrical_vert | test | def cylindrical_vert(script, radius=1.0, inside=True):
"""Select all vertices within a cylindrical radius
Args:
radius (float): radius of the sphere
center_pt (3 coordinate tuple or list): center point of the sphere
Layer stack:
No impacts
MeshLab versions:
2016.12
... | python | {
"resource": ""
} |
q269959 | spherical_vert | test | def spherical_vert(script, radius=1.0, center_pt=(0.0, 0.0, 0.0)):
"""Select all vertices within a spherical radius
Args:
radius (float): radius of the sphere
center_pt (3 coordinate tuple or list): center point of the sphere
Layer stack:
No impacts
MeshLab versions:
2... | python | {
"resource": ""
} |
q269960 | join | test | def join(script, merge_visible=True, merge_vert=False, delete_layer=True,
keep_unreferenced_vert=False):
""" Flatten all or only the visible layers into a single new mesh.
Transformations are preserved. Existing layers can be optionally
deleted.
Args:
script: the mlx.FilterScript obje... | python | {
"resource": ""
} |
q269961 | rename | test | def rename(script, label='blank', layer_num=None):
""" Rename layer label
Can be useful for outputting mlp files, as the output file names use
the labels.
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
label (str): new label for the mes... | python | {
"resource": ""
} |
q269962 | change | test | def change(script, layer_num=None):
""" Change the current layer by specifying the new layer number.
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
layer_num (int): the number of the layer to change to. Default is the
last layer if s... | python | {
"resource": ""
} |
q269963 | duplicate | test | def duplicate(script, layer_num=None):
""" Duplicate a layer.
New layer label is '*_copy'.
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
layer_num (int): layer number to duplicate. Default is the
current layer. Not supported on... | python | {
"resource": ""
} |
q269964 | delete_lower | test | def delete_lower(script, layer_num=None):
""" Delete all layers below the specified one.
Useful for MeshLab ver 2016.12, whcih will only output layer 0.
"""
if layer_num is None:
layer_num = script.current_layer()
if layer_num != 0:
change(script, 0)
for i in range(layer_num):
... | python | {
"resource": ""
} |
q269965 | handle_error | test | def handle_error(program_name, cmd, log=None):
"""Subprocess program error handling
Args:
program_name (str): name of the subprocess program
Returns:
break_now (bool): indicate whether calling program should break out of loop
"""
print('\nHouston, we have a problem.',
'\... | python | {
"resource": ""
} |
q269966 | begin | test | def begin(script='TEMP3D_default.mlx', file_in=None, mlp_in=None):
"""Create new mlx script and write opening tags.
Performs special processing on stl files.
If no input files are provided this will create a dummy
file and delete it as the first filter. This works around
the meshlab limitation tha... | python | {
"resource": ""
} |
q269967 | FilterScript.add_layer | test | def add_layer(self, label, change_layer=True):
""" Add new mesh layer to the end of the stack
Args:
label (str): new label for the mesh layer
change_layer (bool): change to the newly created layer
"""
self.layer_stack.insert(self.last_layer() + 1, label)
... | python | {
"resource": ""
} |
q269968 | FilterScript.del_layer | test | def del_layer(self, layer_num):
""" Delete mesh layer """
del self.layer_stack[layer_num]
# Adjust current layer if needed
if layer_num < self.current_layer():
self.set_current_layer(self.current_layer() - 1)
return None | python | {
"resource": ""
} |
q269969 | FilterScript.save_to_file | test | def save_to_file(self, script_file):
""" Save filter script to an mlx file """
# TODO: rasie exception here instead?
if not self.filters:
print('WARNING: no filters to save to file!')
script_file_descriptor = open(script_file, 'w')
script_file_descriptor.write(''.join... | python | {
"resource": ""
} |
q269970 | FilterScript.run_script | test | def run_script(self, log=None, ml_log=None, mlp_out=None, overwrite=False,
file_out=None, output_mask=None, script_file=None, print_meshlabserver_output=True):
""" Run the script
"""
temp_script = False
temp_ml_log = False
if self.__no_file_in:
# ... | python | {
"resource": ""
} |
q269971 | main | test | def main():
"""Run main script"""
# segments = number of segments to use for circles
segments = 50
# star_points = number of points (or sides) of the star
star_points = 5
# star_radius = radius of circle circumscribing the star
star_radius = 2
# ring_thickness = thickness of the colored ... | python | {
"resource": ""
} |
q269972 | hausdorff_distance | test | def hausdorff_distance(script, sampled_layer=1, target_layer=0,
save_sample=False, sample_vert=True, sample_edge=True,
sample_faux_edge=False, sample_face=True,
sample_num=1000, maxdist=10):
""" Compute the Hausdorff Distance between two meshes, s... | python | {
"resource": ""
} |
q269973 | poisson_disk | test | def poisson_disk(script, sample_num=1000, radius=0.0,
montecarlo_rate=20, save_montecarlo=False,
approx_geodesic_dist=False, subsample=False, refine=False,
refine_layer=0, best_sample=True, best_sample_pool=10,
exact_num=False, radius_variance=1.0):
... | python | {
"resource": ""
} |
q269974 | mesh_element | test | def mesh_element(script, sample_num=1000, element='VERT'):
""" Create a new layer populated with a point sampling of the current mesh,
at most one sample for each element of the mesh is created.
Samples are taking in a uniform way, one for each element
(vertex/edge/face); all the elements have the ... | python | {
"resource": ""
} |
q269975 | clustered_vert | test | def clustered_vert(script, cell_size=1.0, strategy='AVERAGE', selected=False):
""" "Create a new layer populated with a subsampling of the vertexes of the
current mesh
The subsampling is driven by a simple one-per-gridded cell strategy.
Args:
script: the FilterScript object or script filen... | python | {
"resource": ""
} |
q269976 | flat_plane | test | def flat_plane(script, plane=0, aspect_ratio=False):
"""Flat plane parameterization
"""
filter_xml = ''.join([
' <filter name="Parametrization: Flat Plane ">\n',
' <Param name="projectionPlane"',
'value="%d"' % plane,
'description="Projection plane"',
'enum_val0=... | python | {
"resource": ""
} |
q269977 | per_triangle | test | def per_triangle(script, sidedim=0, textdim=1024, border=2, method=1):
"""Trivial Per-Triangle parameterization
"""
filter_xml = ''.join([
' <filter name="Parametrization: Trivial Per-Triangle ">\n',
' <Param name="sidedim"',
'value="%d"' % sidedim,
'description="Quads p... | python | {
"resource": ""
} |
q269978 | voronoi | test | def voronoi(script, region_num=10, overlap=False):
"""Voronoi Atlas parameterization
"""
filter_xml = ''.join([
' <filter name="Parametrization: Voronoi Atlas">\n',
' <Param name="regionNum"',
'value="%d"' % region_num,
'description="Approx. Region Num"',
'type="... | python | {
"resource": ""
} |
q269979 | measure_topology | test | def measure_topology(script):
""" Compute a set of topological measures over a mesh
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
Layer stack:
No impacts
MeshLab versions:
2016.12
1.3.4BETA
"""
filter_xml = ' ... | python | {
"resource": ""
} |
q269980 | parse_topology | test | def parse_topology(ml_log, log=None, ml_version='1.3.4BETA', print_output=False):
"""Parse the ml_log file generated by the measure_topology function.
Args:
ml_log (str): MeshLab log file to parse
log (str): filename to log output
Returns:
dict: dictionary with the following keys:
... | python | {
"resource": ""
} |
q269981 | parse_hausdorff | test | def parse_hausdorff(ml_log, log=None, print_output=False):
"""Parse the ml_log file generated by the hausdorff_distance function.
Args:
ml_log (str): MeshLab log file to parse
log (str): filename to log output
Returns:
dict: dictionary with the following keys:
number_po... | python | {
"resource": ""
} |
q269982 | function | test | def function(script, red=255, green=255, blue=255, alpha=255, color=None):
"""Color function using muparser lib to generate new RGBA color for every
vertex
Red, Green, Blue and Alpha channels may be defined by specifying a function
for each.
See help(mlx.muparser_ref) for muparser reference do... | python | {
"resource": ""
} |
q269983 | voronoi | test | def voronoi(script, target_layer=0, source_layer=1, backward=True):
""" Given a Mesh 'M' and a Pointset 'P', the filter projects each vertex of
P over M and color M according to the geodesic distance from these
projected points. Projection and coloring are done on a per vertex
basis.
Ar... | python | {
"resource": ""
} |
q269984 | cyclic_rainbow | test | def cyclic_rainbow(script, direction='sphere', start_pt=(0, 0, 0),
amplitude=255 / 2, center=255 / 2, freq=0.8,
phase=(0, 120, 240, 0), alpha=False):
""" Color mesh vertices in a repeating sinusiodal rainbow pattern
Sine wave follows the following equation for each color c... | python | {
"resource": ""
} |
q269985 | mp_atan2 | test | def mp_atan2(y, x):
"""muparser atan2 function
Implements an atan2(y,x) function for older muparser versions (<2.1.0);
atan2 was added as a built-in function in muparser 2.1.0
Args:
y (str): y argument of the atan2(y,x) function
x (str): x argument of the atan2(y,x) function
Retur... | python | {
"resource": ""
} |
q269986 | v_cross | test | def v_cross(u, v):
"""muparser cross product function
Compute the cross product of two 3x1 vectors
Args:
u (list or tuple of 3 strings): first vector
v (list or tuple of 3 strings): second vector
Returns:
A list containing a muparser string of the cross product
"""
"""
... | python | {
"resource": ""
} |
q269987 | v_multiply | test | def v_multiply(scalar, v1):
""" Multiply vector by scalar"""
vector = []
for i, x in enumerate(v1):
vector.append('(({})*({}))'.format(scalar, v1[i]))
return vector | python | {
"resource": ""
} |
q269988 | vert_attr | test | def vert_attr(script, name='radius', function='x^2 + y^2'):
""" Add a new Per-Vertex scalar attribute to current mesh and fill it with
the defined function.
The specified name can be used in other filter functions.
It's possible to use parenthesis, per-vertex variables and boolean operator:
... | python | {
"resource": ""
} |
q269989 | flip | test | def flip(script, force_flip=False, selected=False):
""" Invert faces orientation, flipping the normals of the mesh.
If requested, it tries to guess the right orientation; mainly it decides to
flip all the faces if the minimum/maximum vertexes have not outward point
normals for a few directions. Works w... | python | {
"resource": ""
} |
q269990 | point_sets | test | def point_sets(script, neighbors=10, smooth_iteration=0, flip=False,
viewpoint_pos=(0.0, 0.0, 0.0)):
""" Compute the normals of the vertices of a mesh without exploiting the
triangle connectivity, useful for dataset with no faces.
Args:
script: the FilterScript object or script f... | python | {
"resource": ""
} |
q269991 | taubin | test | def taubin(script, iterations=10, t_lambda=0.5, t_mu=-0.53, selected=False):
""" The lambda & mu Taubin smoothing, it make two steps of smoothing, forth
and back, for each iteration.
Based on:
Gabriel Taubin
"A signal processing approach to fair surface design"
Siggraph 1995
Args:
... | python | {
"resource": ""
} |
q269992 | depth | test | def depth(script, iterations=3, viewpoint=(0, 0, 0), selected=False):
""" A laplacian smooth that is constrained to move vertices only along the
view direction.
Args:
script: the FilterScript object or script filename to write
the filter to.
iterations (int): The number of t... | python | {
"resource": ""
} |
q269993 | polylinesort | test | def polylinesort(fbasename=None, log=None):
"""Sort separate line segments in obj format into a continuous polyline or polylines.
NOT FINISHED; DO NOT USE
Also measures the length of each polyline
Return polyline and polylineMeta (lengths)
"""
fext = os.path.splitext(fbasename)[1][1:].strip()... | python | {
"resource": ""
} |
q269994 | measure_topology | test | def measure_topology(fbasename=None, log=None, ml_version=ml_version):
"""Measures mesh topology
Args:
fbasename (str): input filename.
log (str): filename to log output
Returns:
dict: dictionary with the following keys:
vert_num (int): number of vertices
ed... | python | {
"resource": ""
} |
q269995 | measure_all | test | def measure_all(fbasename=None, log=None, ml_version=ml_version):
"""Measures mesh geometry, aabb and topology."""
ml_script1_file = 'TEMP3D_measure_gAndT.mlx'
if ml_version == '1.3.4BETA':
file_out = 'TEMP3D_aabb.xyz'
else:
file_out = None
ml_script1 = mlx.FilterScript(file_in=fbas... | python | {
"resource": ""
} |
q269996 | measure_dimension | test | def measure_dimension(fbasename=None, log=None, axis1=None, offset1=0.0,
axis2=None, offset2=0.0, ml_version=ml_version):
"""Measure a dimension of a mesh"""
axis1 = axis1.lower()
axis2 = axis2.lower()
ml_script1_file = 'TEMP3D_measure_dimension.mlx'
file_out = 'TEMP3D_measure_... | python | {
"resource": ""
} |
q269997 | lowercase_ext | test | def lowercase_ext(filename):
"""
This is a helper used by UploadSet.save to provide lowercase extensions for
all processed files, to compare with configured extensions in the same
case.
.. versionchanged:: 0.1.4
Filenames without extensions are no longer lowercased, only the
extension... | python | {
"resource": ""
} |
q269998 | patch_request_class | test | def patch_request_class(app, size=64 * 1024 * 1024):
"""
By default, Flask will accept uploads to an arbitrary size. While Werkzeug
switches uploads from memory to a temporary file when they hit 500 KiB,
it's still possible for someone to overload your disk space with a
gigantic file.
This patc... | python | {
"resource": ""
} |
q269999 | config_for_set | test | def config_for_set(uset, app, defaults=None):
"""
This is a helper function for `configure_uploads` that extracts the
configuration for a single set.
:param uset: The upload set.
:param app: The app to load the configuration from.
:param defaults: A dict with keys `url` and `dest` from the
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.