repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
rueckstiess/mtools | mtools/util/profile_collection.py | ProfileCollection.num_events | def num_events(self):
"""Lazy evaluation of the number of events."""
if not self._num_events:
self._num_events = self.coll_handle.count()
return self._num_events | python | def num_events(self):
"""Lazy evaluation of the number of events."""
if not self._num_events:
self._num_events = self.coll_handle.count()
return self._num_events | [
"def",
"num_events",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_num_events",
":",
"self",
".",
"_num_events",
"=",
"self",
".",
"coll_handle",
".",
"count",
"(",
")",
"return",
"self",
".",
"_num_events"
] | Lazy evaluation of the number of events. | [
"Lazy",
"evaluation",
"of",
"the",
"number",
"of",
"events",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/profile_collection.py#L88-L92 | train |
rueckstiess/mtools | mtools/util/profile_collection.py | ProfileCollection.next | def next(self):
"""Make iterators."""
if not self.cursor:
self.cursor = self.coll_handle.find().sort([("ts", ASCENDING)])
doc = self.cursor.next()
doc['thread'] = self.name
le = LogEvent(doc)
return le | python | def next(self):
"""Make iterators."""
if not self.cursor:
self.cursor = self.coll_handle.find().sort([("ts", ASCENDING)])
doc = self.cursor.next()
doc['thread'] = self.name
le = LogEvent(doc)
return le | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"cursor",
":",
"self",
".",
"cursor",
"=",
"self",
".",
"coll_handle",
".",
"find",
"(",
")",
".",
"sort",
"(",
"[",
"(",
"\"ts\"",
",",
"ASCENDING",
")",
"]",
")",
"doc",
"=",
"se... | Make iterators. | [
"Make",
"iterators",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/profile_collection.py#L94-L102 | train |
rueckstiess/mtools | mtools/util/profile_collection.py | ProfileCollection._calculate_bounds | def _calculate_bounds(self):
"""Calculate beginning and end of log events."""
# get start datetime
first = self.coll_handle.find_one(None, sort=[("ts", ASCENDING)])
last = self.coll_handle.find_one(None, sort=[("ts", DESCENDING)])
self._start = first['ts']
if self._start... | python | def _calculate_bounds(self):
"""Calculate beginning and end of log events."""
# get start datetime
first = self.coll_handle.find_one(None, sort=[("ts", ASCENDING)])
last = self.coll_handle.find_one(None, sort=[("ts", DESCENDING)])
self._start = first['ts']
if self._start... | [
"def",
"_calculate_bounds",
"(",
"self",
")",
":",
"first",
"=",
"self",
".",
"coll_handle",
".",
"find_one",
"(",
"None",
",",
"sort",
"=",
"[",
"(",
"\"ts\"",
",",
"ASCENDING",
")",
"]",
")",
"last",
"=",
"self",
".",
"coll_handle",
".",
"find_one",
... | Calculate beginning and end of log events. | [
"Calculate",
"beginning",
"and",
"end",
"of",
"log",
"events",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/profile_collection.py#L117-L131 | train |
rueckstiess/mtools | mtools/mloginfo/sections/distinct_section.py | DistinctSection.run | def run(self):
"""Run each line through log2code and group by matched pattern."""
if ProfileCollection and isinstance(self.mloginfo.logfile,
ProfileCollection):
print("\n not available for system.profile collections\n")
return
... | python | def run(self):
"""Run each line through log2code and group by matched pattern."""
if ProfileCollection and isinstance(self.mloginfo.logfile,
ProfileCollection):
print("\n not available for system.profile collections\n")
return
... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"ProfileCollection",
"and",
"isinstance",
"(",
"self",
".",
"mloginfo",
".",
"logfile",
",",
"ProfileCollection",
")",
":",
"print",
"(",
"\"\\n not available for system.profile collections\\n\"",
")",
"return",
"codelin... | Run each line through log2code and group by matched pattern. | [
"Run",
"each",
"line",
"through",
"log2code",
"and",
"group",
"by",
"matched",
"pattern",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mloginfo/sections/distinct_section.py#L39-L108 | train |
rueckstiess/mtools | mtools/util/pattern.py | shell2json | def shell2json(s):
"""Convert shell syntax to json."""
replace = {
r'BinData\(.+?\)': '1',
r'(new )?Date\(.+?\)': '1',
r'Timestamp\(.+?\)': '1',
r'ObjectId\(.+?\)': '1',
r'DBRef\(.+?\)': '1',
r'undefined': '1',
r'MinKey': '1',
r'MaxKey': '1',
... | python | def shell2json(s):
"""Convert shell syntax to json."""
replace = {
r'BinData\(.+?\)': '1',
r'(new )?Date\(.+?\)': '1',
r'Timestamp\(.+?\)': '1',
r'ObjectId\(.+?\)': '1',
r'DBRef\(.+?\)': '1',
r'undefined': '1',
r'MinKey': '1',
r'MaxKey': '1',
... | [
"def",
"shell2json",
"(",
"s",
")",
":",
"replace",
"=",
"{",
"r'BinData\\(.+?\\)'",
":",
"'1'",
",",
"r'(new )?Date\\(.+?\\)'",
":",
"'1'",
",",
"r'Timestamp\\(.+?\\)'",
":",
"'1'",
",",
"r'ObjectId\\(.+?\\)'",
":",
"'1'",
",",
"r'DBRef\\(.+?\\)'",
":",
"'1'",
... | Convert shell syntax to json. | [
"Convert",
"shell",
"syntax",
"to",
"json",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/pattern.py#L52-L70 | train |
rueckstiess/mtools | mtools/util/pattern.py | json2pattern | def json2pattern(s):
"""
Convert JSON format to a query pattern.
Includes even mongo shell notation without quoted key names.
"""
# make valid JSON by wrapping field names in quotes
s, _ = re.subn(r'([{,])\s*([^,{\s\'"]+)\s*:', ' \\1 "\\2" : ', s)
# handle shell values that are not valid JS... | python | def json2pattern(s):
"""
Convert JSON format to a query pattern.
Includes even mongo shell notation without quoted key names.
"""
# make valid JSON by wrapping field names in quotes
s, _ = re.subn(r'([{,])\s*([^,{\s\'"]+)\s*:', ' \\1 "\\2" : ', s)
# handle shell values that are not valid JS... | [
"def",
"json2pattern",
"(",
"s",
")",
":",
"s",
",",
"_",
"=",
"re",
".",
"subn",
"(",
"r'([{,])\\s*([^,{\\s\\'\"]+)\\s*:'",
",",
"' \\\\1 \"\\\\2\" : '",
",",
"s",
")",
"s",
"=",
"shell2json",
"(",
"s",
")",
"s",
",",
"n",
"=",
"re",
".",
"subn",
"(... | Convert JSON format to a query pattern.
Includes even mongo shell notation without quoted key names. | [
"Convert",
"JSON",
"format",
"to",
"a",
"query",
"pattern",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/pattern.py#L73-L90 | train |
rueckstiess/mtools | mtools/util/print_table.py | print_table | def print_table(rows, override_headers=None, uppercase_headers=True):
"""All rows need to be a list of dictionaries, all with the same keys."""
if len(rows) == 0:
return
keys = list(rows[0].keys())
headers = override_headers or keys
if uppercase_headers:
rows = [dict(zip(keys,
... | python | def print_table(rows, override_headers=None, uppercase_headers=True):
"""All rows need to be a list of dictionaries, all with the same keys."""
if len(rows) == 0:
return
keys = list(rows[0].keys())
headers = override_headers or keys
if uppercase_headers:
rows = [dict(zip(keys,
... | [
"def",
"print_table",
"(",
"rows",
",",
"override_headers",
"=",
"None",
",",
"uppercase_headers",
"=",
"True",
")",
":",
"if",
"len",
"(",
"rows",
")",
"==",
"0",
":",
"return",
"keys",
"=",
"list",
"(",
"rows",
"[",
"0",
"]",
".",
"keys",
"(",
")... | All rows need to be a list of dictionaries, all with the same keys. | [
"All",
"rows",
"need",
"to",
"be",
"a",
"list",
"of",
"dictionaries",
"all",
"with",
"the",
"same",
"keys",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/print_table.py#L3-L30 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent.set_line_str | def set_line_str(self, line_str):
"""
Set line_str.
Line_str is only writeable if LogEvent was created from a string,
not from a system.profile documents.
"""
if not self.from_string:
raise ValueError("can't set line_str for LogEvent created from "
... | python | def set_line_str(self, line_str):
"""
Set line_str.
Line_str is only writeable if LogEvent was created from a string,
not from a system.profile documents.
"""
if not self.from_string:
raise ValueError("can't set line_str for LogEvent created from "
... | [
"def",
"set_line_str",
"(",
"self",
",",
"line_str",
")",
":",
"if",
"not",
"self",
".",
"from_string",
":",
"raise",
"ValueError",
"(",
"\"can't set line_str for LogEvent created from \"",
"\"system.profile documents.\"",
")",
"if",
"line_str",
"!=",
"self",
".",
"... | Set line_str.
Line_str is only writeable if LogEvent was created from a string,
not from a system.profile documents. | [
"Set",
"line_str",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L141-L154 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent.get_line_str | def get_line_str(self):
"""Return line_str depending on source, logfile or system.profile."""
if self.from_string:
return ' '.join([s for s in [self.merge_marker_str,
self._datetime_str,
self._line_str] if s])
... | python | def get_line_str(self):
"""Return line_str depending on source, logfile or system.profile."""
if self.from_string:
return ' '.join([s for s in [self.merge_marker_str,
self._datetime_str,
self._line_str] if s])
... | [
"def",
"get_line_str",
"(",
"self",
")",
":",
"if",
"self",
".",
"from_string",
":",
"return",
"' '",
".",
"join",
"(",
"[",
"s",
"for",
"s",
"in",
"[",
"self",
".",
"merge_marker_str",
",",
"self",
".",
"_datetime_str",
",",
"self",
".",
"_line_str",
... | Return line_str depending on source, logfile or system.profile. | [
"Return",
"line_str",
"depending",
"on",
"source",
"logfile",
"or",
"system",
".",
"profile",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L156-L164 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent._match_datetime_pattern | def _match_datetime_pattern(self, tokens):
"""
Match the datetime pattern at the beginning of the token list.
There are several formats that this method needs to understand
and distinguish between (see MongoDB's SERVER-7965):
ctime-pre2.4 Wed Dec 31 19:00:00
ctime ... | python | def _match_datetime_pattern(self, tokens):
"""
Match the datetime pattern at the beginning of the token list.
There are several formats that this method needs to understand
and distinguish between (see MongoDB's SERVER-7965):
ctime-pre2.4 Wed Dec 31 19:00:00
ctime ... | [
"def",
"_match_datetime_pattern",
"(",
"self",
",",
"tokens",
")",
":",
"assume_iso8601_format",
"=",
"len",
"(",
"tokens",
")",
"<",
"4",
"if",
"not",
"assume_iso8601_format",
":",
"weekday",
",",
"month",
",",
"day",
",",
"time",
"=",
"tokens",
"[",
":",... | Match the datetime pattern at the beginning of the token list.
There are several formats that this method needs to understand
and distinguish between (see MongoDB's SERVER-7965):
ctime-pre2.4 Wed Dec 31 19:00:00
ctime Wed Dec 31 19:00:00.000
iso8601-utc 1970-01... | [
"Match",
"the",
"datetime",
"pattern",
"at",
"the",
"beginning",
"of",
"the",
"token",
"list",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L282-L333 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent._extract_operation_and_namespace | def _extract_operation_and_namespace(self):
"""
Helper method to extract both operation and namespace from a logevent.
It doesn't make sense to only extract one as they appear back to back
in the token list.
"""
split_tokens = self.split_tokens
if not self._date... | python | def _extract_operation_and_namespace(self):
"""
Helper method to extract both operation and namespace from a logevent.
It doesn't make sense to only extract one as they appear back to back
in the token list.
"""
split_tokens = self.split_tokens
if not self._date... | [
"def",
"_extract_operation_and_namespace",
"(",
"self",
")",
":",
"split_tokens",
"=",
"self",
".",
"split_tokens",
"if",
"not",
"self",
".",
"_datetime_nextpos",
":",
"_",
"=",
"self",
".",
"thread",
"if",
"not",
"self",
".",
"_datetime_nextpos",
"or",
"(",
... | Helper method to extract both operation and namespace from a logevent.
It doesn't make sense to only extract one as they appear back to back
in the token list. | [
"Helper",
"method",
"to",
"extract",
"both",
"operation",
"and",
"namespace",
"from",
"a",
"logevent",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L395-L427 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent._extract_counters | def _extract_counters(self):
"""Extract counters like nscanned and nreturned from the logevent."""
# extract counters (if present)
counters = ['nscanned', 'nscannedObjects', 'ntoreturn', 'nreturned',
'ninserted', 'nupdated', 'ndeleted', 'r', 'w', 'numYields',
... | python | def _extract_counters(self):
"""Extract counters like nscanned and nreturned from the logevent."""
# extract counters (if present)
counters = ['nscanned', 'nscannedObjects', 'ntoreturn', 'nreturned',
'ninserted', 'nupdated', 'ndeleted', 'r', 'w', 'numYields',
... | [
"def",
"_extract_counters",
"(",
"self",
")",
":",
"counters",
"=",
"[",
"'nscanned'",
",",
"'nscannedObjects'",
",",
"'ntoreturn'",
",",
"'nreturned'",
",",
"'ninserted'",
",",
"'nupdated'",
",",
"'ndeleted'",
",",
"'r'",
",",
"'w'",
",",
"'numYields'",
",",
... | Extract counters like nscanned and nreturned from the logevent. | [
"Extract",
"counters",
"like",
"nscanned",
"and",
"nreturned",
"from",
"the",
"logevent",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L626-L685 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent.parse_all | def parse_all(self):
"""
Trigger extraction of all information.
These values are usually evaluated lazily.
"""
tokens = self.split_tokens
duration = self.duration
datetime = self.datetime
thread = self.thread
operation = self.operation
nam... | python | def parse_all(self):
"""
Trigger extraction of all information.
These values are usually evaluated lazily.
"""
tokens = self.split_tokens
duration = self.duration
datetime = self.datetime
thread = self.thread
operation = self.operation
nam... | [
"def",
"parse_all",
"(",
"self",
")",
":",
"tokens",
"=",
"self",
".",
"split_tokens",
"duration",
"=",
"self",
".",
"duration",
"datetime",
"=",
"self",
".",
"datetime",
"thread",
"=",
"self",
".",
"thread",
"operation",
"=",
"self",
".",
"operation",
"... | Trigger extraction of all information.
These values are usually evaluated lazily. | [
"Trigger",
"extraction",
"of",
"all",
"information",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L721-L743 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent.to_dict | def to_dict(self, labels=None):
"""Convert LogEvent object to a dictionary."""
output = {}
if labels is None:
labels = ['line_str', 'split_tokens', 'datetime', 'operation',
'thread', 'namespace', 'nscanned', 'ntoreturn',
'nreturned', 'ninse... | python | def to_dict(self, labels=None):
"""Convert LogEvent object to a dictionary."""
output = {}
if labels is None:
labels = ['line_str', 'split_tokens', 'datetime', 'operation',
'thread', 'namespace', 'nscanned', 'ntoreturn',
'nreturned', 'ninse... | [
"def",
"to_dict",
"(",
"self",
",",
"labels",
"=",
"None",
")",
":",
"output",
"=",
"{",
"}",
"if",
"labels",
"is",
"None",
":",
"labels",
"=",
"[",
"'line_str'",
",",
"'split_tokens'",
",",
"'datetime'",
",",
"'operation'",
",",
"'thread'",
",",
"'nam... | Convert LogEvent object to a dictionary. | [
"Convert",
"LogEvent",
"object",
"to",
"a",
"dictionary",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L823-L837 | train |
rueckstiess/mtools | mtools/util/logevent.py | LogEvent.to_json | def to_json(self, labels=None):
"""Convert LogEvent object to valid JSON."""
output = self.to_dict(labels)
return json.dumps(output, cls=DateTimeEncoder, ensure_ascii=False) | python | def to_json(self, labels=None):
"""Convert LogEvent object to valid JSON."""
output = self.to_dict(labels)
return json.dumps(output, cls=DateTimeEncoder, ensure_ascii=False) | [
"def",
"to_json",
"(",
"self",
",",
"labels",
"=",
"None",
")",
":",
"output",
"=",
"self",
".",
"to_dict",
"(",
"labels",
")",
"return",
"json",
".",
"dumps",
"(",
"output",
",",
"cls",
"=",
"DateTimeEncoder",
",",
"ensure_ascii",
"=",
"False",
")"
] | Convert LogEvent object to valid JSON. | [
"Convert",
"LogEvent",
"object",
"to",
"valid",
"JSON",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/logevent.py#L839-L842 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool.addFilter | def addFilter(self, filterclass):
"""Add a filter class to the parser."""
if filterclass not in self.filters:
self.filters.append(filterclass) | python | def addFilter(self, filterclass):
"""Add a filter class to the parser."""
if filterclass not in self.filters:
self.filters.append(filterclass) | [
"def",
"addFilter",
"(",
"self",
",",
"filterclass",
")",
":",
"if",
"filterclass",
"not",
"in",
"self",
".",
"filters",
":",
"self",
".",
"filters",
".",
"append",
"(",
"filterclass",
")"
] | Add a filter class to the parser. | [
"Add",
"a",
"filter",
"class",
"to",
"the",
"parser",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L71-L74 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool._outputLine | def _outputLine(self, logevent, length=None, human=False):
"""
Print the final line.
Provides various options (length, human, datetime changes, ...).
"""
# adapt timezone output if necessary
if self.args['timestamp_format'] != 'none':
logevent._reformat_times... | python | def _outputLine(self, logevent, length=None, human=False):
"""
Print the final line.
Provides various options (length, human, datetime changes, ...).
"""
# adapt timezone output if necessary
if self.args['timestamp_format'] != 'none':
logevent._reformat_times... | [
"def",
"_outputLine",
"(",
"self",
",",
"logevent",
",",
"length",
"=",
"None",
",",
"human",
"=",
"False",
")",
":",
"if",
"self",
".",
"args",
"[",
"'timestamp_format'",
"]",
"!=",
"'none'",
":",
"logevent",
".",
"_reformat_timestamp",
"(",
"self",
"."... | Print the final line.
Provides various options (length, human, datetime changes, ...). | [
"Print",
"the",
"final",
"line",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L83-L112 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool._msToString | def _msToString(self, ms):
"""Change milliseconds to hours min sec ms format."""
hr, ms = divmod(ms, 3600000)
mins, ms = divmod(ms, 60000)
secs, mill = divmod(ms, 1000)
return "%ihr %imin %isecs %ims" % (hr, mins, secs, mill) | python | def _msToString(self, ms):
"""Change milliseconds to hours min sec ms format."""
hr, ms = divmod(ms, 3600000)
mins, ms = divmod(ms, 60000)
secs, mill = divmod(ms, 1000)
return "%ihr %imin %isecs %ims" % (hr, mins, secs, mill) | [
"def",
"_msToString",
"(",
"self",
",",
"ms",
")",
":",
"hr",
",",
"ms",
"=",
"divmod",
"(",
"ms",
",",
"3600000",
")",
"mins",
",",
"ms",
"=",
"divmod",
"(",
"ms",
",",
"60000",
")",
"secs",
",",
"mill",
"=",
"divmod",
"(",
"ms",
",",
"1000",
... | Change milliseconds to hours min sec ms format. | [
"Change",
"milliseconds",
"to",
"hours",
"min",
"sec",
"ms",
"format",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L114-L119 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool._changeMs | def _changeMs(self, line):
"""Change the ms part in the string if needed."""
# use the position of the last space instead
try:
last_space_pos = line.rindex(' ')
except ValueError:
return line
else:
end_str = line[last_space_pos:]
ne... | python | def _changeMs(self, line):
"""Change the ms part in the string if needed."""
# use the position of the last space instead
try:
last_space_pos = line.rindex(' ')
except ValueError:
return line
else:
end_str = line[last_space_pos:]
ne... | [
"def",
"_changeMs",
"(",
"self",
",",
"line",
")",
":",
"try",
":",
"last_space_pos",
"=",
"line",
".",
"rindex",
"(",
"' '",
")",
"except",
"ValueError",
":",
"return",
"line",
"else",
":",
"end_str",
"=",
"line",
"[",
"last_space_pos",
":",
"]",
"new... | Change the ms part in the string if needed. | [
"Change",
"the",
"ms",
"part",
"in",
"the",
"string",
"if",
"needed",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L121-L139 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool._formatNumbers | def _formatNumbers(self, line):
"""
Format the numbers so that there are commas inserted.
For example: 1200300 becomes 1,200,300.
"""
# below thousands separator syntax only works for
# python 2.7, skip for 2.6
if sys.version_info < (2, 7):
return lin... | python | def _formatNumbers(self, line):
"""
Format the numbers so that there are commas inserted.
For example: 1200300 becomes 1,200,300.
"""
# below thousands separator syntax only works for
# python 2.7, skip for 2.6
if sys.version_info < (2, 7):
return lin... | [
"def",
"_formatNumbers",
"(",
"self",
",",
"line",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"2",
",",
"7",
")",
":",
"return",
"line",
"last_index",
"=",
"0",
"try",
":",
"last_index",
"=",
"(",
"line",
".",
"rindex",
"(",
"'}'",
")",
... | Format the numbers so that there are commas inserted.
For example: 1200300 becomes 1,200,300. | [
"Format",
"the",
"numbers",
"so",
"that",
"there",
"are",
"commas",
"inserted",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L141-L172 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool._datetime_key_for_merge | def _datetime_key_for_merge(self, logevent):
"""Helper method for ordering log lines correctly during merge."""
if not logevent:
# if logfile end is reached, return max datetime to never
# pick this line
return datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzutc())
... | python | def _datetime_key_for_merge(self, logevent):
"""Helper method for ordering log lines correctly during merge."""
if not logevent:
# if logfile end is reached, return max datetime to never
# pick this line
return datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzutc())
... | [
"def",
"_datetime_key_for_merge",
"(",
"self",
",",
"logevent",
")",
":",
"if",
"not",
"logevent",
":",
"return",
"datetime",
"(",
"MAXYEAR",
",",
"12",
",",
"31",
",",
"23",
",",
"59",
",",
"59",
",",
"999999",
",",
"tzutc",
"(",
")",
")",
"return",... | Helper method for ordering log lines correctly during merge. | [
"Helper",
"method",
"for",
"ordering",
"log",
"lines",
"correctly",
"during",
"merge",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L174-L184 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool._merge_logfiles | def _merge_logfiles(self):
"""Helper method to merge several files together by datetime."""
# open files, read first lines, extract first dates
lines = [next(iter(logfile), None) for logfile in self.args['logfile']]
# adjust lines by timezone
for i in range(len(lines)):
... | python | def _merge_logfiles(self):
"""Helper method to merge several files together by datetime."""
# open files, read first lines, extract first dates
lines = [next(iter(logfile), None) for logfile in self.args['logfile']]
# adjust lines by timezone
for i in range(len(lines)):
... | [
"def",
"_merge_logfiles",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"next",
"(",
"iter",
"(",
"logfile",
")",
",",
"None",
")",
"for",
"logfile",
"in",
"self",
".",
"args",
"[",
"'logfile'",
"]",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"... | Helper method to merge several files together by datetime. | [
"Helper",
"method",
"to",
"merge",
"several",
"files",
"together",
"by",
"datetime",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L186-L212 | train |
rueckstiess/mtools | mtools/mlogfilter/mlogfilter.py | MLogFilterTool.logfile_generator | def logfile_generator(self):
"""Yield each line of the file, or the next line if several files."""
if not self.args['exclude']:
# ask all filters for a start_limit and fast-forward to the maximum
start_limits = [f.start_limit for f in self.filters
if h... | python | def logfile_generator(self):
"""Yield each line of the file, or the next line if several files."""
if not self.args['exclude']:
# ask all filters for a start_limit and fast-forward to the maximum
start_limits = [f.start_limit for f in self.filters
if h... | [
"def",
"logfile_generator",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"args",
"[",
"'exclude'",
"]",
":",
"start_limits",
"=",
"[",
"f",
".",
"start_limit",
"for",
"f",
"in",
"self",
".",
"filters",
"if",
"hasattr",
"(",
"f",
",",
"'start_limit'... | Yield each line of the file, or the next line if several files. | [
"Yield",
"each",
"line",
"of",
"the",
"file",
"or",
"the",
"next",
"line",
"if",
"several",
"files",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L214-L236 | train |
rueckstiess/mtools | mtools/mlogfilter/filters/mask_filter.py | MaskFilter.setup | def setup(self):
"""
Create mask list.
Consists of all tuples between which this filter accepts lines.
"""
# get start and end of the mask and set a start_limit
if not self.mask_source.start:
raise SystemExit("Can't parse format of %s. Is this a log file or "... | python | def setup(self):
"""
Create mask list.
Consists of all tuples between which this filter accepts lines.
"""
# get start and end of the mask and set a start_limit
if not self.mask_source.start:
raise SystemExit("Can't parse format of %s. Is this a log file or "... | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"mask_source",
".",
"start",
":",
"raise",
"SystemExit",
"(",
"\"Can't parse format of %s. Is this a log file or \"",
"\"system.profile collection?\"",
"%",
"self",
".",
"mlogfilter",
".",
"args",
"[",... | Create mask list.
Consists of all tuples between which this filter accepts lines. | [
"Create",
"mask",
"list",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/filters/mask_filter.py#L60-L135 | train |
rueckstiess/mtools | mtools/util/parse_sourcecode.py | source_files | def source_files(mongodb_path):
"""Find source files."""
for root, dirs, files in os.walk(mongodb_path):
for filename in files:
# skip files in dbtests folder
if 'dbtests' in root:
continue
if filename.endswith(('.cpp', '.c', '.h')):
yi... | python | def source_files(mongodb_path):
"""Find source files."""
for root, dirs, files in os.walk(mongodb_path):
for filename in files:
# skip files in dbtests folder
if 'dbtests' in root:
continue
if filename.endswith(('.cpp', '.c', '.h')):
yi... | [
"def",
"source_files",
"(",
"mongodb_path",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"mongodb_path",
")",
":",
"for",
"filename",
"in",
"files",
":",
"if",
"'dbtests'",
"in",
"root",
":",
"continue",
"if",
"file... | Find source files. | [
"Find",
"source",
"files",
"."
] | a6a22910c3569c0c8a3908660ca218a4557e4249 | https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/util/parse_sourcecode.py#L23-L31 | train |
ansible-community/ara | ara/views/result.py | index | def index():
"""
This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with result.show_result directly and are instead
dynamically generated through javas... | python | def index():
"""
This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with result.show_result directly and are instead
dynamically generated through javas... | [
"def",
"index",
"(",
")",
":",
"if",
"current_app",
".",
"config",
"[",
"'ARA_PLAYBOOK_OVERRIDE'",
"]",
"is",
"not",
"None",
":",
"override",
"=",
"current_app",
".",
"config",
"[",
"'ARA_PLAYBOOK_OVERRIDE'",
"]",
"results",
"=",
"(",
"models",
".",
"TaskRes... | This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with result.show_result directly and are instead
dynamically generated through javascript for performance pur... | [
"This",
"is",
"not",
"served",
"anywhere",
"in",
"the",
"web",
"application",
".",
"It",
"is",
"used",
"explicitly",
"in",
"the",
"context",
"of",
"generating",
"static",
"files",
"since",
"flask",
"-",
"frozen",
"requires",
"url_for",
"s",
"to",
"crawl",
... | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/views/result.py#L28-L44 | train |
ansible-community/ara | ara/models.py | content_sha1 | def content_sha1(context):
"""
Used by the FileContent model to automatically compute the sha1
hash of content before storing it to the database.
"""
try:
content = context.current_parameters['content']
except AttributeError:
content = context
return hashlib.sha1(encodeutils.... | python | def content_sha1(context):
"""
Used by the FileContent model to automatically compute the sha1
hash of content before storing it to the database.
"""
try:
content = context.current_parameters['content']
except AttributeError:
content = context
return hashlib.sha1(encodeutils.... | [
"def",
"content_sha1",
"(",
"context",
")",
":",
"try",
":",
"content",
"=",
"context",
".",
"current_parameters",
"[",
"'content'",
"]",
"except",
"AttributeError",
":",
"content",
"=",
"context",
"return",
"hashlib",
".",
"sha1",
"(",
"encodeutils",
".",
"... | Used by the FileContent model to automatically compute the sha1
hash of content before storing it to the database. | [
"Used",
"by",
"the",
"FileContent",
"model",
"to",
"automatically",
"compute",
"the",
"sha1",
"hash",
"of",
"content",
"before",
"storing",
"it",
"to",
"the",
"database",
"."
] | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/models.py#L53-L62 | train |
ansible-community/ara | ara/views/about.py | main | def main():
""" Returns the about page """
files = models.File.query
hosts = models.Host.query
facts = models.HostFacts.query
playbooks = models.Playbook.query
records = models.Data.query
tasks = models.Task.query
results = models.TaskResult.query
if current_app.config['ARA_PLAYBOOK... | python | def main():
""" Returns the about page """
files = models.File.query
hosts = models.Host.query
facts = models.HostFacts.query
playbooks = models.Playbook.query
records = models.Data.query
tasks = models.Task.query
results = models.TaskResult.query
if current_app.config['ARA_PLAYBOOK... | [
"def",
"main",
"(",
")",
":",
"files",
"=",
"models",
".",
"File",
".",
"query",
"hosts",
"=",
"models",
".",
"Host",
".",
"query",
"facts",
"=",
"models",
".",
"HostFacts",
".",
"query",
"playbooks",
"=",
"models",
".",
"Playbook",
".",
"query",
"re... | Returns the about page | [
"Returns",
"the",
"about",
"page"
] | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/views/about.py#L29-L63 | train |
ansible-community/ara | ara/views/host.py | index | def index():
"""
This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with host.show_host directly and are instead
dynamically generated through javascrip... | python | def index():
"""
This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with host.show_host directly and are instead
dynamically generated through javascrip... | [
"def",
"index",
"(",
")",
":",
"if",
"current_app",
".",
"config",
"[",
"'ARA_PLAYBOOK_OVERRIDE'",
"]",
"is",
"not",
"None",
":",
"override",
"=",
"current_app",
".",
"config",
"[",
"'ARA_PLAYBOOK_OVERRIDE'",
"]",
"hosts",
"=",
"(",
"models",
".",
"Host",
... | This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with host.show_host directly and are instead
dynamically generated through javascript for performance purpose... | [
"This",
"is",
"not",
"served",
"anywhere",
"in",
"the",
"web",
"application",
".",
"It",
"is",
"used",
"explicitly",
"in",
"the",
"context",
"of",
"generating",
"static",
"files",
"since",
"flask",
"-",
"frozen",
"requires",
"url_for",
"s",
"to",
"crawl",
... | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/views/host.py#L31-L46 | train |
ansible-community/ara | ara/config/webapp.py | WebAppConfig.config | def config(self):
""" Returns a dictionary for the loaded configuration """
return {
key: self.__dict__[key]
for key in dir(self)
if key.isupper()
} | python | def config(self):
""" Returns a dictionary for the loaded configuration """
return {
key: self.__dict__[key]
for key in dir(self)
if key.isupper()
} | [
"def",
"config",
"(",
"self",
")",
":",
"return",
"{",
"key",
":",
"self",
".",
"__dict__",
"[",
"key",
"]",
"for",
"key",
"in",
"dir",
"(",
"self",
")",
"if",
"key",
".",
"isupper",
"(",
")",
"}"
] | Returns a dictionary for the loaded configuration | [
"Returns",
"a",
"dictionary",
"for",
"the",
"loaded",
"configuration"
] | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/config/webapp.py#L58-L64 | train |
ansible-community/ara | ara/views/file.py | index | def index():
"""
This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with file.show_file directly and are instead
dynamically generated through javascrip... | python | def index():
"""
This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with file.show_file directly and are instead
dynamically generated through javascrip... | [
"def",
"index",
"(",
")",
":",
"if",
"current_app",
".",
"config",
"[",
"'ARA_PLAYBOOK_OVERRIDE'",
"]",
"is",
"not",
"None",
":",
"override",
"=",
"current_app",
".",
"config",
"[",
"'ARA_PLAYBOOK_OVERRIDE'",
"]",
"files",
"=",
"(",
"models",
".",
"File",
... | This is not served anywhere in the web application.
It is used explicitly in the context of generating static files since
flask-frozen requires url_for's to crawl content.
url_for's are not used with file.show_file directly and are instead
dynamically generated through javascript for performance purpose... | [
"This",
"is",
"not",
"served",
"anywhere",
"in",
"the",
"web",
"application",
".",
"It",
"is",
"used",
"explicitly",
"in",
"the",
"context",
"of",
"generating",
"static",
"files",
"since",
"flask",
"-",
"frozen",
"requires",
"url_for",
"s",
"to",
"crawl",
... | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/views/file.py#L28-L43 | train |
ansible-community/ara | ara/views/file.py | show_file | def show_file(file_):
"""
Returns details of a file
"""
file_ = (models.File.query.get(file_))
if file_ is None:
abort(404)
return render_template('file.html', file_=file_) | python | def show_file(file_):
"""
Returns details of a file
"""
file_ = (models.File.query.get(file_))
if file_ is None:
abort(404)
return render_template('file.html', file_=file_) | [
"def",
"show_file",
"(",
"file_",
")",
":",
"file_",
"=",
"(",
"models",
".",
"File",
".",
"query",
".",
"get",
"(",
"file_",
")",
")",
"if",
"file_",
"is",
"None",
":",
"abort",
"(",
"404",
")",
"return",
"render_template",
"(",
"'file.html'",
",",
... | Returns details of a file | [
"Returns",
"details",
"of",
"a",
"file"
] | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/views/file.py#L47-L55 | train |
ansible-community/ara | ara/webapp.py | configure_db | def configure_db(app):
"""
0.10 is the first version of ARA that ships with a stable database schema.
We can identify a database that originates from before this by checking if
there is an alembic revision available.
If there is no alembic revision available, assume we are running the first
revi... | python | def configure_db(app):
"""
0.10 is the first version of ARA that ships with a stable database schema.
We can identify a database that originates from before this by checking if
there is an alembic revision available.
If there is no alembic revision available, assume we are running the first
revi... | [
"def",
"configure_db",
"(",
"app",
")",
":",
"models",
".",
"db",
".",
"init_app",
"(",
"app",
")",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'ara.webapp.configure_db'",
")",
"log",
".",
"debug",
"(",
"'Setting up database...'",
")",
"if",
"app",
".",... | 0.10 is the first version of ARA that ships with a stable database schema.
We can identify a database that originates from before this by checking if
there is an alembic revision available.
If there is no alembic revision available, assume we are running the first
revision which contains the latest stat... | [
"0",
".",
"10",
"is",
"the",
"first",
"version",
"of",
"ARA",
"that",
"ships",
"with",
"a",
"stable",
"database",
"schema",
".",
"We",
"can",
"identify",
"a",
"database",
"that",
"originates",
"from",
"before",
"this",
"by",
"checking",
"if",
"there",
"i... | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/webapp.py#L248-L288 | train |
ansible-community/ara | ara/webapp.py | configure_cache | def configure_cache(app):
""" Sets up an attribute to cache data in the app context """
log = logging.getLogger('ara.webapp.configure_cache')
log.debug('Configuring cache')
if not getattr(app, '_cache', None):
app._cache = {} | python | def configure_cache(app):
""" Sets up an attribute to cache data in the app context """
log = logging.getLogger('ara.webapp.configure_cache')
log.debug('Configuring cache')
if not getattr(app, '_cache', None):
app._cache = {} | [
"def",
"configure_cache",
"(",
"app",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'ara.webapp.configure_cache'",
")",
"log",
".",
"debug",
"(",
"'Configuring cache'",
")",
"if",
"not",
"getattr",
"(",
"app",
",",
"'_cache'",
",",
"None",
")",
... | Sets up an attribute to cache data in the app context | [
"Sets",
"up",
"an",
"attribute",
"to",
"cache",
"data",
"in",
"the",
"app",
"context"
] | 15e2d0133c23b6d07438a553bb8149fadff21547 | https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/webapp.py#L318-L324 | train |
orbingol/NURBS-Python | geomdl/convert.py | bspline_to_nurbs | def bspline_to_nurbs(obj):
""" Converts non-rational parametric shapes to rational ones.
:param obj: B-Spline shape
:type obj: BSpline.Curve, BSpline.Surface or BSpline.Volume
:return: NURBS shape
:rtype: NURBS.Curve, NURBS.Surface or NURBS.Volume
:raises: TypeError
"""
# B-Spline -> NU... | python | def bspline_to_nurbs(obj):
""" Converts non-rational parametric shapes to rational ones.
:param obj: B-Spline shape
:type obj: BSpline.Curve, BSpline.Surface or BSpline.Volume
:return: NURBS shape
:rtype: NURBS.Curve, NURBS.Surface or NURBS.Volume
:raises: TypeError
"""
# B-Spline -> NU... | [
"def",
"bspline_to_nurbs",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"BSpline",
".",
"Curve",
")",
":",
"return",
"_convert",
".",
"convert_curve",
"(",
"obj",
",",
"NURBS",
")",
"elif",
"isinstance",
"(",
"obj",
",",
"BSpline",
".",
"... | Converts non-rational parametric shapes to rational ones.
:param obj: B-Spline shape
:type obj: BSpline.Curve, BSpline.Surface or BSpline.Volume
:return: NURBS shape
:rtype: NURBS.Curve, NURBS.Surface or NURBS.Volume
:raises: TypeError | [
"Converts",
"non",
"-",
"rational",
"parametric",
"shapes",
"to",
"rational",
"ones",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/convert.py#L14-L31 | train |
orbingol/NURBS-Python | geomdl/convert.py | nurbs_to_bspline | def nurbs_to_bspline(obj, **kwargs):
""" Extracts the non-rational components from rational parametric shapes, if possible.
The possibility of converting a rational shape to a non-rational one depends on the weights vector.
:param obj: NURBS shape
:type obj: NURBS.Curve, NURBS.Surface or NURBS.Volume
... | python | def nurbs_to_bspline(obj, **kwargs):
""" Extracts the non-rational components from rational parametric shapes, if possible.
The possibility of converting a rational shape to a non-rational one depends on the weights vector.
:param obj: NURBS shape
:type obj: NURBS.Curve, NURBS.Surface or NURBS.Volume
... | [
"def",
"nurbs_to_bspline",
"(",
"obj",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"obj",
".",
"rational",
":",
"raise",
"TypeError",
"(",
"\"The input must be a rational shape\"",
")",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"10e-8",
")",
"fo... | Extracts the non-rational components from rational parametric shapes, if possible.
The possibility of converting a rational shape to a non-rational one depends on the weights vector.
:param obj: NURBS shape
:type obj: NURBS.Curve, NURBS.Surface or NURBS.Volume
:return: B-Spline shape
:rtype: BSpli... | [
"Extracts",
"the",
"non",
"-",
"rational",
"components",
"from",
"rational",
"parametric",
"shapes",
"if",
"possible",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/convert.py#L34-L65 | train |
orbingol/NURBS-Python | geomdl/_linalg.py | doolittle | def doolittle(matrix_a):
""" Doolittle's Method for LU-factorization.
:param matrix_a: Input matrix (must be a square matrix)
:type matrix_a: list, tuple
:return: a tuple containing matrices (L,U)
:rtype: tuple
"""
# Initialize L and U matrices
matrix_u = [[0.0 for _ in range(len(matrix... | python | def doolittle(matrix_a):
""" Doolittle's Method for LU-factorization.
:param matrix_a: Input matrix (must be a square matrix)
:type matrix_a: list, tuple
:return: a tuple containing matrices (L,U)
:rtype: tuple
"""
# Initialize L and U matrices
matrix_u = [[0.0 for _ in range(len(matrix... | [
"def",
"doolittle",
"(",
"matrix_a",
")",
":",
"matrix_u",
"=",
"[",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"matrix_a",
")",
")",
"]",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"matrix_a",
")",
")",
"]",
"matrix_l",
"=",
"[",
... | Doolittle's Method for LU-factorization.
:param matrix_a: Input matrix (must be a square matrix)
:type matrix_a: list, tuple
:return: a tuple containing matrices (L,U)
:rtype: tuple | [
"Doolittle",
"s",
"Method",
"for",
"LU",
"-",
"factorization",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_linalg.py#L14-L42 | train |
orbingol/NURBS-Python | setup.py | read_files | def read_files(project, ext):
""" Reads files inside the input project directory. """
project_path = os.path.join(os.path.dirname(__file__), project)
file_list = os.listdir(project_path)
flist = []
flist_path = []
for f in file_list:
f_path = os.path.join(project_path, f)
if os.p... | python | def read_files(project, ext):
""" Reads files inside the input project directory. """
project_path = os.path.join(os.path.dirname(__file__), project)
file_list = os.listdir(project_path)
flist = []
flist_path = []
for f in file_list:
f_path = os.path.join(project_path, f)
if os.p... | [
"def",
"read_files",
"(",
"project",
",",
"ext",
")",
":",
"project_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"project",
")",
"file_list",
"=",
"os",
".",
"listdir",
"(",
"project_p... | Reads files inside the input project directory. | [
"Reads",
"files",
"inside",
"the",
"input",
"project",
"directory",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/setup.py#L141-L152 | train |
orbingol/NURBS-Python | setup.py | copy_files | def copy_files(src, ext, dst):
""" Copies files with extensions "ext" from "src" to "dst" directory. """
src_path = os.path.join(os.path.dirname(__file__), src)
dst_path = os.path.join(os.path.dirname(__file__), dst)
file_list = os.listdir(src_path)
for f in file_list:
if f == '__init__.py'... | python | def copy_files(src, ext, dst):
""" Copies files with extensions "ext" from "src" to "dst" directory. """
src_path = os.path.join(os.path.dirname(__file__), src)
dst_path = os.path.join(os.path.dirname(__file__), dst)
file_list = os.listdir(src_path)
for f in file_list:
if f == '__init__.py'... | [
"def",
"copy_files",
"(",
"src",
",",
"ext",
",",
"dst",
")",
":",
"src_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"src",
")",
"dst_path",
"=",
"os",
".",
"path",
".",
"join",
... | Copies files with extensions "ext" from "src" to "dst" directory. | [
"Copies",
"files",
"with",
"extensions",
"ext",
"from",
"src",
"to",
"dst",
"directory",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/setup.py#L155-L165 | train |
orbingol/NURBS-Python | setup.py | make_dir | def make_dir(project):
""" Creates the project directory for compiled modules. """
project_path = os.path.join(os.path.dirname(__file__), project)
# Delete the directory and the files inside it
if os.path.exists(project_path):
shutil.rmtree(project_path)
# Create the directory
os.mkdir(p... | python | def make_dir(project):
""" Creates the project directory for compiled modules. """
project_path = os.path.join(os.path.dirname(__file__), project)
# Delete the directory and the files inside it
if os.path.exists(project_path):
shutil.rmtree(project_path)
# Create the directory
os.mkdir(p... | [
"def",
"make_dir",
"(",
"project",
")",
":",
"project_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"project",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"project_path",
")",
"... | Creates the project directory for compiled modules. | [
"Creates",
"the",
"project",
"directory",
"for",
"compiled",
"modules",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/setup.py#L168-L180 | train |
orbingol/NURBS-Python | setup.py | in_argv | def in_argv(arg_list):
""" Checks if any of the elements of the input list is in sys.argv array. """
for arg in sys.argv:
for parg in arg_list:
if parg == arg or arg.startswith(parg):
return True
return False | python | def in_argv(arg_list):
""" Checks if any of the elements of the input list is in sys.argv array. """
for arg in sys.argv:
for parg in arg_list:
if parg == arg or arg.startswith(parg):
return True
return False | [
"def",
"in_argv",
"(",
"arg_list",
")",
":",
"for",
"arg",
"in",
"sys",
".",
"argv",
":",
"for",
"parg",
"in",
"arg_list",
":",
"if",
"parg",
"==",
"arg",
"or",
"arg",
".",
"startswith",
"(",
"parg",
")",
":",
"return",
"True",
"return",
"False"
] | Checks if any of the elements of the input list is in sys.argv array. | [
"Checks",
"if",
"any",
"of",
"the",
"elements",
"of",
"the",
"input",
"list",
"is",
"in",
"sys",
".",
"argv",
"array",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/setup.py#L183-L189 | train |
orbingol/NURBS-Python | geomdl/knotvector.py | generate | def generate(degree, num_ctrlpts, **kwargs):
""" Generates an equally spaced knot vector.
It uses the following equality to generate knot vector: :math:`m = n + p + 1`
where;
* :math:`p`, degree
* :math:`n + 1`, number of control points
* :math:`m + 1`, number of knots
Keyword Arguments:... | python | def generate(degree, num_ctrlpts, **kwargs):
""" Generates an equally spaced knot vector.
It uses the following equality to generate knot vector: :math:`m = n + p + 1`
where;
* :math:`p`, degree
* :math:`n + 1`, number of control points
* :math:`m + 1`, number of knots
Keyword Arguments:... | [
"def",
"generate",
"(",
"degree",
",",
"num_ctrlpts",
",",
"**",
"kwargs",
")",
":",
"if",
"degree",
"==",
"0",
"or",
"num_ctrlpts",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Input values should be different than zero.\"",
")",
"clamped",
"=",
"kwargs",
"... | Generates an equally spaced knot vector.
It uses the following equality to generate knot vector: :math:`m = n + p + 1`
where;
* :math:`p`, degree
* :math:`n + 1`, number of control points
* :math:`m + 1`, number of knots
Keyword Arguments:
* ``clamped``: Flag to choose from clamped ... | [
"Generates",
"an",
"equally",
"spaced",
"knot",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/knotvector.py#L15-L65 | train |
orbingol/NURBS-Python | geomdl/knotvector.py | check | def check(degree, knot_vector, num_ctrlpts):
""" Checks the validity of the input knot vector.
Please refer to The NURBS Book (2nd Edition), p.50 for details.
:param degree: degree of the curve or the surface
:type degree: int
:param knot_vector: knot vector to be checked
:type knot_vector: li... | python | def check(degree, knot_vector, num_ctrlpts):
""" Checks the validity of the input knot vector.
Please refer to The NURBS Book (2nd Edition), p.50 for details.
:param degree: degree of the curve or the surface
:type degree: int
:param knot_vector: knot vector to be checked
:type knot_vector: li... | [
"def",
"check",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
")",
":",
"try",
":",
"if",
"knot_vector",
"is",
"None",
"or",
"len",
"(",
"knot_vector",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Input knot vector cannot be empty\"",
")",
"e... | Checks the validity of the input knot vector.
Please refer to The NURBS Book (2nd Edition), p.50 for details.
:param degree: degree of the curve or the surface
:type degree: int
:param knot_vector: knot vector to be checked
:type knot_vector: list, tuple
:param num_ctrlpts: number of control p... | [
"Checks",
"the",
"validity",
"of",
"the",
"input",
"knot",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/knotvector.py#L99-L133 | train |
orbingol/NURBS-Python | geomdl/fitting.py | interpolate_curve | def interpolate_curve(points, degree, **kwargs):
""" Curve interpolation through the data points.
Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param... | python | def interpolate_curve(points, degree, **kwargs):
""" Curve interpolation through the data points.
Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param... | [
"def",
"interpolate_curve",
"(",
"points",
",",
"degree",
",",
"**",
"kwargs",
")",
":",
"use_centripetal",
"=",
"kwargs",
".",
"get",
"(",
"'centripetal'",
",",
"False",
")",
"num_points",
"=",
"len",
"(",
"points",
")",
"uk",
"=",
"compute_params_curve",
... | Curve interpolation through the data points.
Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param points: data points
:type points: list, tuple
:p... | [
"Curve",
"interpolation",
"through",
"the",
"data",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/fitting.py#L16-L53 | train |
orbingol/NURBS-Python | geomdl/fitting.py | interpolate_surface | def interpolate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
""" Surface interpolation through the data points.
Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization meth... | python | def interpolate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
""" Surface interpolation through the data points.
Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization meth... | [
"def",
"interpolate_surface",
"(",
"points",
",",
"size_u",
",",
"size_v",
",",
"degree_u",
",",
"degree_v",
",",
"**",
"kwargs",
")",
":",
"use_centripetal",
"=",
"kwargs",
".",
"get",
"(",
"'centripetal'",
",",
"False",
")",
"uk",
",",
"vl",
"=",
"comp... | Surface interpolation through the data points.
Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param points: data points
:type points: list, tuple
... | [
"Surface",
"interpolation",
"through",
"the",
"data",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/fitting.py#L57-L112 | train |
orbingol/NURBS-Python | geomdl/fitting.py | compute_knot_vector | def compute_knot_vector(degree, num_points, params):
""" Computes a knot vector from the parameter list using averaging method.
Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.
:param degree: degree
:type degree: int
:param num_points: number of data points
... | python | def compute_knot_vector(degree, num_points, params):
""" Computes a knot vector from the parameter list using averaging method.
Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.
:param degree: degree
:type degree: int
:param num_points: number of data points
... | [
"def",
"compute_knot_vector",
"(",
"degree",
",",
"num_points",
",",
"params",
")",
":",
"kv",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",
"]",
"for",
"i",
"in",
"range",
"(",
"num_points",
"-",
"degree",
"-",
"1",
")"... | Computes a knot vector from the parameter list using averaging method.
Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.
:param degree: degree
:type degree: int
:param num_points: number of data points
:type num_points: int
:param params: list of parameters,... | [
"Computes",
"a",
"knot",
"vector",
"from",
"the",
"parameter",
"list",
"using",
"averaging",
"method",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/fitting.py#L358-L383 | train |
orbingol/NURBS-Python | geomdl/fitting.py | ginterp | def ginterp(coeff_matrix, points):
""" Applies global interpolation to the set of data points to find control points.
:param coeff_matrix: coefficient matrix
:type coeff_matrix: list, tuple
:param points: data points
:type points: list, tuple
:return: control points
:rtype: list
"""
... | python | def ginterp(coeff_matrix, points):
""" Applies global interpolation to the set of data points to find control points.
:param coeff_matrix: coefficient matrix
:type coeff_matrix: list, tuple
:param points: data points
:type points: list, tuple
:return: control points
:rtype: list
"""
... | [
"def",
"ginterp",
"(",
"coeff_matrix",
",",
"points",
")",
":",
"dim",
"=",
"len",
"(",
"points",
"[",
"0",
"]",
")",
"num_points",
"=",
"len",
"(",
"points",
")",
"matrix_l",
",",
"matrix_u",
"=",
"linalg",
".",
"lu_decomposition",
"(",
"coeff_matrix",
... | Applies global interpolation to the set of data points to find control points.
:param coeff_matrix: coefficient matrix
:type coeff_matrix: list, tuple
:param points: data points
:type points: list, tuple
:return: control points
:rtype: list | [
"Applies",
"global",
"interpolation",
"to",
"the",
"set",
"of",
"data",
"points",
"to",
"find",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/fitting.py#L509-L536 | train |
orbingol/NURBS-Python | geomdl/fitting.py | _build_coeff_matrix | def _build_coeff_matrix(degree, knotvector, params, points):
""" Builds the coefficient matrix for global interpolation.
This function only uses data points to build the coefficient matrix. Please refer to The NURBS Book (2nd Edition),
pp364-370 for details.
:param degree: degree
:type degree: int... | python | def _build_coeff_matrix(degree, knotvector, params, points):
""" Builds the coefficient matrix for global interpolation.
This function only uses data points to build the coefficient matrix. Please refer to The NURBS Book (2nd Edition),
pp364-370 for details.
:param degree: degree
:type degree: int... | [
"def",
"_build_coeff_matrix",
"(",
"degree",
",",
"knotvector",
",",
"params",
",",
"points",
")",
":",
"num_points",
"=",
"len",
"(",
"points",
")",
"matrix_a",
"=",
"[",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"num_points",
")",
"]",
"for",
"_",
... | Builds the coefficient matrix for global interpolation.
This function only uses data points to build the coefficient matrix. Please refer to The NURBS Book (2nd Edition),
pp364-370 for details.
:param degree: degree
:type degree: int
:param knotvector: knot vector
:type knotvector: list, tuple... | [
"Builds",
"the",
"coefficient",
"matrix",
"for",
"global",
"interpolation",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/fitting.py#L539-L566 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_render_window | def create_render_window(actors, callbacks, **kwargs):
""" Creates VTK render window with an interactor.
:param actors: list of VTK actors
:type actors: list, tuple
:param callbacks: callback functions for registering custom events
:type callbacks: dict
"""
# Get keyword arguments
figur... | python | def create_render_window(actors, callbacks, **kwargs):
""" Creates VTK render window with an interactor.
:param actors: list of VTK actors
:type actors: list, tuple
:param callbacks: callback functions for registering custom events
:type callbacks: dict
"""
# Get keyword arguments
figur... | [
"def",
"create_render_window",
"(",
"actors",
",",
"callbacks",
",",
"**",
"kwargs",
")",
":",
"figure_size",
"=",
"kwargs",
".",
"get",
"(",
"'figure_size'",
",",
"(",
"800",
",",
"600",
")",
")",
"camera_position",
"=",
"kwargs",
".",
"get",
"(",
"'cam... | Creates VTK render window with an interactor.
:param actors: list of VTK actors
:type actors: list, tuple
:param callbacks: callback functions for registering custom events
:type callbacks: dict | [
"Creates",
"VTK",
"render",
"window",
"with",
"an",
"interactor",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L14-L73 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_color | def create_color(color):
""" Creates VTK-compatible RGB color from a color string.
:param color: color
:type color: str
:return: RGB color values
:rtype: list
"""
if color[0] == "#":
# Convert hex string to RGB
return [int(color[i:i + 2], 16) / 255 for i in range(1, 7, 2)]
... | python | def create_color(color):
""" Creates VTK-compatible RGB color from a color string.
:param color: color
:type color: str
:return: RGB color values
:rtype: list
"""
if color[0] == "#":
# Convert hex string to RGB
return [int(color[i:i + 2], 16) / 255 for i in range(1, 7, 2)]
... | [
"def",
"create_color",
"(",
"color",
")",
":",
"if",
"color",
"[",
"0",
"]",
"==",
"\"#\"",
":",
"return",
"[",
"int",
"(",
"color",
"[",
"i",
":",
"i",
"+",
"2",
"]",
",",
"16",
")",
"/",
"255",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"7... | Creates VTK-compatible RGB color from a color string.
:param color: color
:type color: str
:return: RGB color values
:rtype: list | [
"Creates",
"VTK",
"-",
"compatible",
"RGB",
"color",
"from",
"a",
"color",
"string",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L76-L90 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_pts | def create_actor_pts(pts, color, **kwargs):
""" Creates a VTK actor for rendering scatter plots.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', ... | python | def create_actor_pts(pts, color, **kwargs):
""" Creates a VTK actor for rendering scatter plots.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', ... | [
"def",
"create_actor_pts",
"(",
"pts",
",",
"color",
",",
"**",
"kwargs",
")",
":",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"0",
")",
"point_size",
"=",
... | Creates a VTK actor for rendering scatter plots.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"scatter",
"plots",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L93-L135 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_polygon | def create_actor_polygon(pts, color, **kwargs):
""" Creates a VTK actor for rendering polygons.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', "... | python | def create_actor_polygon(pts, color, **kwargs):
""" Creates a VTK actor for rendering polygons.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', "... | [
"def",
"create_actor_polygon",
"(",
"pts",
",",
"color",
",",
"**",
"kwargs",
")",
":",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"0",
")",
"line_width",
"="... | Creates a VTK actor for rendering polygons.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"polygons",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L138-L186 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_mesh | def create_actor_mesh(pts, lines, color, **kwargs):
""" Creates a VTK actor for rendering quadrilateral plots.
:param pts: points
:type pts: vtkFloatArray
:param lines: point connectivity information
:type lines: vtkIntArray
:param color: actor color
:type color: list
:return: a VTK act... | python | def create_actor_mesh(pts, lines, color, **kwargs):
""" Creates a VTK actor for rendering quadrilateral plots.
:param pts: points
:type pts: vtkFloatArray
:param lines: point connectivity information
:type lines: vtkIntArray
:param color: actor color
:type color: list
:return: a VTK act... | [
"def",
"create_actor_mesh",
"(",
"pts",
",",
"lines",
",",
"color",
",",
"**",
"kwargs",
")",
":",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"0",
")",
"lin... | Creates a VTK actor for rendering quadrilateral plots.
:param pts: points
:type pts: vtkFloatArray
:param lines: point connectivity information
:type lines: vtkIntArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"quadrilateral",
"plots",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L189-L238 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_tri | def create_actor_tri(pts, tris, color, **kwargs):
""" Creates a VTK actor for rendering triangulated surface plots.
:param pts: points
:type pts: vtkFloatArray
:param tris: list of triangle indices
:type tris: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
... | python | def create_actor_tri(pts, tris, color, **kwargs):
""" Creates a VTK actor for rendering triangulated surface plots.
:param pts: points
:type pts: vtkFloatArray
:param tris: list of triangle indices
:type tris: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
... | [
"def",
"create_actor_tri",
"(",
"pts",
",",
"tris",
",",
"color",
",",
"**",
"kwargs",
")",
":",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"0",
")",
"point... | Creates a VTK actor for rendering triangulated surface plots.
:param pts: points
:type pts: vtkFloatArray
:param tris: list of triangle indices
:type tris: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"triangulated",
"surface",
"plots",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L241-L286 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_hexahedron | def create_actor_hexahedron(grid, color, **kwargs):
""" Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name ... | python | def create_actor_hexahedron(grid, color, **kwargs):
""" Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name ... | [
"def",
"create_actor_hexahedron",
"(",
"grid",
",",
"color",
",",
"**",
"kwargs",
")",
":",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"0",
")",
"points",
"="... | Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"voxels",
"using",
"hexahedron",
"elements",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L289-L336 | train |
orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_delaunay | def create_actor_delaunay(pts, color, **kwargs):
""" Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloat... | python | def create_actor_delaunay(pts, color, **kwargs):
""" Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloat... | [
"def",
"create_actor_delaunay",
"(",
"pts",
",",
"color",
",",
"**",
"kwargs",
")",
":",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"0",
")",
"use_delaunay3d",
... | Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list... | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"triangulated",
"plots",
"using",
"Delaunay",
"triangulation",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L339-L381 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | flip_ctrlpts_u | def flip_ctrlpts_u(ctrlpts, size_u, size_v):
""" Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:typ... | python | def flip_ctrlpts_u(ctrlpts, size_u, size_v):
""" Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:typ... | [
"def",
"flip_ctrlpts_u",
"(",
"ctrlpts",
",",
"size_u",
",",
"size_v",
")",
":",
"new_ctrlpts",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"size_u",
")",
":",
"for",
"j",
"in",
"range",
"(",
"0",
",",
"size_v",
")",
":",
"temp",
"="... | Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:type ctrlpts: list, tuple
:param size_u: size in u-d... | [
"Flips",
"a",
"list",
"of",
"1",
"-",
"dimensional",
"control",
"points",
"from",
"u",
"-",
"row",
"order",
"to",
"v",
"-",
"row",
"order",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L11-L33 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | generate_ctrlptsw | def generate_ctrlptsw(ctrlpts):
""" Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D co... | python | def generate_ctrlptsw(ctrlpts):
""" Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D co... | [
"def",
"generate_ctrlptsw",
"(",
"ctrlpts",
")",
":",
"new_ctrlpts",
"=",
"[",
"]",
"for",
"cpt",
"in",
"ctrlpts",
":",
"temp",
"=",
"[",
"float",
"(",
"pt",
"*",
"cpt",
"[",
"-",
"1",
"]",
")",
"for",
"pt",
"in",
"cpt",
"]",
"temp",
"[",
"-",
... | Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D control points (P)
:type ctrlpts: list... | [
"Generates",
"weighted",
"control",
"points",
"from",
"unweighted",
"ones",
"in",
"1",
"-",
"D",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L86-L107 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | generate_ctrlpts_weights | def generate_ctrlpts_weights(ctrlpts):
""" Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the... | python | def generate_ctrlpts_weights(ctrlpts):
""" Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the... | [
"def",
"generate_ctrlpts_weights",
"(",
"ctrlpts",
")",
":",
"new_ctrlpts",
"=",
"[",
"]",
"for",
"cpt",
"in",
"ctrlpts",
":",
"temp",
"=",
"[",
"float",
"(",
"pt",
"/",
"cpt",
"[",
"-",
"1",
"]",
")",
"for",
"pt",
"in",
"cpt",
"]",
"temp",
"[",
... | Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the result
:param ctrlpts: 1-D control points... | [
"Generates",
"unweighted",
"control",
"points",
"from",
"weighted",
"ones",
"in",
"1",
"-",
"D",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L139-L160 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | combine_ctrlpts_weights | def combine_ctrlpts_weights(ctrlpts, weights=None):
""" Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the ... | python | def combine_ctrlpts_weights(ctrlpts, weights=None):
""" Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the ... | [
"def",
"combine_ctrlpts_weights",
"(",
"ctrlpts",
",",
"weights",
"=",
"None",
")",
":",
"if",
"weights",
"is",
"None",
":",
"weights",
"=",
"[",
"1.0",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"ctrlpts",
")",
")",
"]",
"ctrlptsw",
"=",
"[",
"]",
... | Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the function generate a weights vector composed of
1.0 value... | [
"Multiplies",
"control",
"points",
"by",
"the",
"weights",
"to",
"generate",
"weighted",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L190-L214 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | separate_ctrlpts_weights | def separate_ctrlpts_weights(ctrlptsw):
""" Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlpts... | python | def separate_ctrlpts_weights(ctrlptsw):
""" Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlpts... | [
"def",
"separate_ctrlpts_weights",
"(",
"ctrlptsw",
")",
":",
"ctrlpts",
"=",
"[",
"]",
"weights",
"=",
"[",
"]",
"for",
"ptw",
"in",
"ctrlptsw",
":",
"temp",
"=",
"[",
"float",
"(",
"pw",
"/",
"ptw",
"[",
"-",
"1",
"]",
")",
"for",
"pw",
"in",
"... | Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlptsw: weighted control points
:type ctrlptsw: l... | [
"Divides",
"weighted",
"control",
"points",
"by",
"weights",
"to",
"generate",
"unweighted",
"control",
"points",
"and",
"weights",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L217-L235 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | flip_ctrlpts2d_file | def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
""" Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type fil... | python | def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
""" Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type fil... | [
"def",
"flip_ctrlpts2d_file",
"(",
"file_in",
"=",
"''",
",",
"file_out",
"=",
"'ctrlpts_flip.txt'",
")",
":",
"ctrlpts2d",
",",
"size_u",
",",
"size_v",
"=",
"_read_ctrltps2d_file",
"(",
"file_in",
")",
"new_ctrlpts2d",
"=",
"flip_ctrlpts2d",
"(",
"ctrlpts2d",
... | Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type file_out: str
:raises IOError: an error occurred reading or writing the f... | [
"Flips",
"u",
"and",
"v",
"directions",
"of",
"a",
"2D",
"control",
"points",
"file",
"and",
"saves",
"flipped",
"coordinates",
"to",
"a",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L238-L254 | train |
orbingol/NURBS-Python | geomdl/compatibility.py | generate_ctrlptsw2d_file | def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'):
""" Generates weighted control points from unweighted ones in 2-D.
This function
#. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format
#. Converts into (x*w, y*w, z*w, w) format
#. Saves the r... | python | def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'):
""" Generates weighted control points from unweighted ones in 2-D.
This function
#. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format
#. Converts into (x*w, y*w, z*w, w) format
#. Saves the r... | [
"def",
"generate_ctrlptsw2d_file",
"(",
"file_in",
"=",
"''",
",",
"file_out",
"=",
"'ctrlptsw.txt'",
")",
":",
"ctrlpts2d",
",",
"size_u",
",",
"size_v",
"=",
"_read_ctrltps2d_file",
"(",
"file_in",
")",
"new_ctrlpts2d",
"=",
"generate_ctrlptsw2d",
"(",
"ctrlpts2... | Generates weighted control points from unweighted ones in 2-D.
This function
#. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format
#. Converts into (x*w, y*w, z*w, w) format
#. Saves the result to a file
Therefore, the resultant file could be a direct input ... | [
"Generates",
"weighted",
"control",
"points",
"from",
"unweighted",
"ones",
"in",
"2",
"-",
"D",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L257-L281 | train |
orbingol/NURBS-Python | geomdl/visualization/VisVTK.py | VisConfig.keypress_callback | def keypress_callback(self, obj, ev):
""" VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
... | python | def keypress_callback(self, obj, ev):
""" VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
... | [
"def",
"keypress_callback",
"(",
"self",
",",
"obj",
",",
"ev",
")",
":",
"key",
"=",
"obj",
".",
"GetKeySym",
"(",
")",
"render_window",
"=",
"obj",
".",
"GetRenderWindow",
"(",
")",
"renderer",
"=",
"render_window",
".",
"GetRenderers",
"(",
")",
".",
... | VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
* ``r``: reset the camera
* ``s`` and... | [
"VTK",
"callback",
"for",
"keypress",
"events",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisVTK.py#L46-L112 | train |
orbingol/NURBS-Python | geomdl/_voxelize.py | generate_voxel_grid | def generate_voxel_grid(bbox, szval, use_cubes=False):
""" Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use... | python | def generate_voxel_grid(bbox, szval, use_cubes=False):
""" Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use... | [
"def",
"generate_voxel_grid",
"(",
"bbox",
",",
"szval",
",",
"use_cubes",
"=",
"False",
")",
":",
"if",
"szval",
"[",
"0",
"]",
"<=",
"1",
"or",
"szval",
"[",
"1",
"]",
"<=",
"1",
"or",
"szval",
"[",
"2",
"]",
"<=",
"1",
":",
"raise",
"GeomdlExc... | Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use_cubes: bool
:return: voxel grid
:rtype: list | [
"Generates",
"the",
"voxel",
"grid",
"with",
"the",
"desired",
"size",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_voxelize.py#L49-L83 | train |
orbingol/NURBS-Python | geomdl/_exchange.py | process_template | def process_template(file_src):
""" Process Jinja2 template input
:param file_src: file contents
:type file_src: str
"""
def tmpl_sqrt(x):
""" Square-root of 'x' """
return math.sqrt(x)
def tmpl_cubert(x):
""" Cube-root of 'x' """
return x ** (1.0 / 3.0) if x >=... | python | def process_template(file_src):
""" Process Jinja2 template input
:param file_src: file contents
:type file_src: str
"""
def tmpl_sqrt(x):
""" Square-root of 'x' """
return math.sqrt(x)
def tmpl_cubert(x):
""" Cube-root of 'x' """
return x ** (1.0 / 3.0) if x >=... | [
"def",
"process_template",
"(",
"file_src",
")",
":",
"def",
"tmpl_sqrt",
"(",
"x",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"x",
")",
"def",
"tmpl_cubert",
"(",
"x",
")",
":",
"return",
"x",
"**",
"(",
"1.0",
"/",
"3.0",
")",
"if",
"x",
">=... | Process Jinja2 template input
:param file_src: file contents
:type file_src: str | [
"Process",
"Jinja2",
"template",
"input"
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_exchange.py#L21-L67 | train |
orbingol/NURBS-Python | geomdl/_exchange.py | import_surf_mesh | def import_surf_mesh(file_name):
""" Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
... | python | def import_surf_mesh(file_name):
""" Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
... | [
"def",
"import_surf_mesh",
"(",
"file_name",
")",
":",
"raw_content",
"=",
"read_file",
"(",
"file_name",
")",
"raw_content",
"=",
"raw_content",
".",
"split",
"(",
"\"\\n\"",
")",
"content",
"=",
"[",
"]",
"for",
"rc",
"in",
"raw_content",
":",
"temp",
"=... | Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface | [
"Generates",
"a",
"NURBS",
"surface",
"object",
"from",
"a",
"mesh",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_exchange.py#L102-L150 | train |
orbingol/NURBS-Python | geomdl/_exchange.py | import_vol_mesh | def import_vol_mesh(file_name):
""" Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
for... | python | def import_vol_mesh(file_name):
""" Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
for... | [
"def",
"import_vol_mesh",
"(",
"file_name",
")",
":",
"raw_content",
"=",
"read_file",
"(",
"file_name",
")",
"raw_content",
"=",
"raw_content",
".",
"split",
"(",
"\"\\n\"",
")",
"content",
"=",
"[",
"]",
"for",
"rc",
"in",
"raw_content",
":",
"temp",
"="... | Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume | [
"Generates",
"a",
"NURBS",
"volume",
"object",
"from",
"a",
"mesh",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_exchange.py#L153-L207 | train |
orbingol/NURBS-Python | geomdl/exchange.py | import_txt | def import_txt(file_name, two_dimensional=False, **kwargs):
""" Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
... | python | def import_txt(file_name, two_dimensional=False, **kwargs):
""" Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
... | [
"def",
"import_txt",
"(",
"file_name",
",",
"two_dimensional",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"content",
"=",
"exch",
".",
"read_file",
"(",
"file_name",
")",
"j2tmpl",
"=",
"kwargs",
".",
"get",
"(",
"'jinja2'",
",",
"False",
")",
"if",
... | Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
# Import curve control points from a text file
curve_ctr... | [
"Reads",
"control",
"points",
"from",
"a",
"text",
"file",
"and",
"generates",
"a",
"1",
"-",
"dimensional",
"list",
"of",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L21-L89 | train |
orbingol/NURBS-Python | geomdl/exchange.py | export_txt | def export_txt(obj, file_name, two_dimensional=False, **kwargs):
""" Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exch... | python | def export_txt(obj, file_name, two_dimensional=False, **kwargs):
""" Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exch... | [
"def",
"export_txt",
"(",
"obj",
",",
"file_name",
",",
"two_dimensional",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"obj",
".",
"ctrlpts",
"is",
"None",
"or",
"len",
"(",
"obj",
".",
"ctrlpts",
")",
"==",
"0",
":",
"raise",
"exch",
".",
"... | Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exchange.import_txt()` for detailed description of the keyword arguments.
... | [
"Exports",
"control",
"points",
"as",
"a",
"text",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L93-L123 | train |
orbingol/NURBS-Python | geomdl/exchange.py | import_csv | def import_csv(file_name, **kwargs):
""" Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
... | python | def import_csv(file_name, **kwargs):
""" Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
... | [
"def",
"import_csv",
"(",
"file_name",
",",
"**",
"kwargs",
")",
":",
"sep",
"=",
"kwargs",
".",
"get",
"(",
"'separator'",
",",
"\",\"",
")",
"content",
"=",
"exch",
".",
"read_file",
"(",
"file_name",
",",
"skip_lines",
"=",
"1",
")",
"return",
"exch... | Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
.. code-block:: python
:linenos:
... | [
"Reads",
"control",
"points",
"from",
"a",
"CSV",
"file",
"and",
"generates",
"a",
"1",
"-",
"dimensional",
"list",
"of",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L127-L155 | train |
orbingol/NURBS-Python | geomdl/exchange.py | export_csv | def export_csv(obj, file_name, point_type='evalpts', **kwargs):
""" Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for contro... | python | def export_csv(obj, file_name, point_type='evalpts', **kwargs):
""" Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for contro... | [
"def",
"export_csv",
"(",
"obj",
",",
"file_name",
",",
"point_type",
"=",
"'evalpts'",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"0",
"<",
"obj",
".",
"pdimension",
"<",
"3",
":",
"raise",
"exch",
".",
"GeomdlException",
"(",
"\"Input object should be a... | Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for control points or ``evalpts`` for evaluated points
:type point_type: str
... | [
"Exports",
"control",
"points",
"or",
"evaluated",
"points",
"as",
"a",
"CSV",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L159-L193 | train |
orbingol/NURBS-Python | geomdl/exchange.py | import_cfg | def import_cfg(file_name, **kwargs):
""" Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param fi... | python | def import_cfg(file_name, **kwargs):
""" Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param fi... | [
"def",
"import_cfg",
"(",
"file_name",
",",
"**",
"kwargs",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"libconf",
".",
"loads",
"(",
"data",
")",
"try",
":",
"import",
"libconf",
"except",
"ImportError",
":",
"raise",
"exch",
".",
"G... | Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type fil... | [
"Imports",
"curves",
"and",
"surfaces",
"from",
"files",
"in",
"libconfig",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L197-L229 | train |
orbingol/NURBS-Python | geomdl/exchange.py | export_cfg | def export_cfg(obj, file_name):
""" Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sh... | python | def export_cfg(obj, file_name):
""" Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sh... | [
"def",
"export_cfg",
"(",
"obj",
",",
"file_name",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"libconf",
".",
"dumps",
"(",
"data",
")",
"try",
":",
"import",
"libconf",
"except",
"ImportError",
":",
"raise",
"exch",
".",
"GeomdlExcept... | Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:pa... | [
"Exports",
"curves",
"and",
"surfaces",
"in",
"libconfig",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L233-L262 | train |
orbingol/NURBS-Python | geomdl/exchange.py | import_yaml | def import_yaml(file_name, **kwargs):
""" Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:para... | python | def import_yaml(file_name, **kwargs):
""" Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:para... | [
"def",
"import_yaml",
"(",
"file_name",
",",
"**",
"kwargs",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"yaml",
"=",
"YAML",
"(",
")",
"return",
"yaml",
".",
"load",
"(",
"data",
")",
"try",
":",
"from",
"ruamel",
".",
"yaml",
"import",
"Y... | Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type ... | [
"Imports",
"curves",
"and",
"surfaces",
"from",
"files",
"in",
"YAML",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L266-L299 | train |
orbingol/NURBS-Python | geomdl/exchange.py | export_yaml | def export_yaml(obj, file_name):
""" Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sha... | python | def export_yaml(obj, file_name):
""" Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sha... | [
"def",
"export_yaml",
"(",
"obj",
",",
"file_name",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"stream",
"=",
"StringIO",
"(",
")",
"yaml",
"=",
"YAML",
"(",
")",
"yaml",
".",
"dump",
"(",
"data",
",",
"stream",
")",
"return",
"stream",
".... | Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:para... | [
"Exports",
"curves",
"and",
"surfaces",
"in",
"YAML",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L303-L336 | train |
orbingol/NURBS-Python | geomdl/exchange.py | import_json | def import_json(file_name, **kwargs):
""" Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spli... | python | def import_json(file_name, **kwargs):
""" Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spli... | [
"def",
"import_json",
"(",
"file_name",
",",
"**",
"kwargs",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"json",
".",
"loads",
"(",
"data",
")",
"delta",
"=",
"kwargs",
".",
"get",
"(",
"'delta'",
",",
"-",
"1.0",
")",
"use_template... | Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spline geometries
:rtype: list
:raises Geo... | [
"Imports",
"curves",
"and",
"surfaces",
"from",
"files",
"in",
"JSON",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L340-L362 | train |
orbingol/NURBS-Python | geomdl/exchange.py | export_json | def export_json(obj, file_name):
""" Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeom... | python | def export_json(obj, file_name):
""" Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeom... | [
"def",
"export_json",
"(",
"obj",
",",
"file_name",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"data",
",",
"indent",
"=",
"4",
")",
"exported_data",
"=",
"exch",
".",
"export_dict_str",
"(",
"obj",
"=",
... | Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeometry, multi.AbstractContainer
:param ... | [
"Exports",
"curves",
"and",
"surfaces",
"in",
"JSON",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L366-L385 | train |
orbingol/NURBS-Python | geomdl/exchange.py | import_obj | def import_obj(file_name, **kwargs):
""" Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_fun... | python | def import_obj(file_name, **kwargs):
""" Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_fun... | [
"def",
"import_obj",
"(",
"file_name",
",",
"**",
"kwargs",
")",
":",
"def",
"default_callback",
"(",
"face_list",
")",
":",
"return",
"face_list",
"callback_func",
"=",
"kwargs",
".",
"get",
"(",
"'callback'",
",",
"default_callback",
")",
"content",
"=",
"... | Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_function(face_list):
# "face_list" w... | [
"Reads",
".",
"obj",
"files",
"and",
"generates",
"faces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L389-L460 | train |
orbingol/NURBS-Python | geomdl/multi.py | select_color | def select_color(cpcolor, evalcolor, idx=0):
""" Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry... | python | def select_color(cpcolor, evalcolor, idx=0):
""" Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry... | [
"def",
"select_color",
"(",
"cpcolor",
",",
"evalcolor",
",",
"idx",
"=",
"0",
")",
":",
"color",
"=",
"utilities",
".",
"color_generator",
"(",
")",
"if",
"isinstance",
"(",
"cpcolor",
",",
"str",
")",
":",
"color",
"[",
"0",
"]",
"=",
"cpcolor",
"i... | Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry object
:type idx: int
:return: a list of col... | [
"Selects",
"item",
"color",
"for",
"plotting",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/multi.py#L1080-L1111 | train |
orbingol/NURBS-Python | geomdl/multi.py | process_tessellate | def process_tessellate(elem, update_delta, delta, **kwargs):
""" Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param ... | python | def process_tessellate(elem, update_delta, delta, **kwargs):
""" Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param ... | [
"def",
"process_tessellate",
"(",
"elem",
",",
"update_delta",
",",
"delta",
",",
"**",
"kwargs",
")",
":",
"if",
"update_delta",
":",
"elem",
".",
"delta",
"=",
"delta",
"elem",
".",
"evaluate",
"(",
")",
"elem",
".",
"tessellate",
"(",
"**",
"kwargs",
... | Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param delta: evaluation delta
:type delta: list, tuple
:return: upd... | [
"Tessellates",
"surfaces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/multi.py#L1114-L1132 | train |
orbingol/NURBS-Python | geomdl/multi.py | process_elements_surface | def process_elements_surface(elem, mconf, colorval, idx, force_tsl, update_delta, delta, reset_names):
""" Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module ... | python | def process_elements_surface(elem, mconf, colorval, idx, force_tsl, update_delta, delta, reset_names):
""" Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module ... | [
"def",
"process_elements_surface",
"(",
"elem",
",",
"mconf",
",",
"colorval",
",",
"idx",
",",
"force_tsl",
",",
"update_delta",
",",
"delta",
",",
"reset_names",
")",
":",
"if",
"idx",
"<",
"0",
":",
"lock",
".",
"acquire",
"(",
")",
"idx",
"=",
"cou... | Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module configuration
:type mconf: dict
:param colorval: color values
:type colorval: tuple
:param idx:... | [
"Processes",
"visualization",
"elements",
"for",
"surfaces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/multi.py#L1135-L1224 | train |
orbingol/NURBS-Python | geomdl/helpers.py | find_span_binsearch | def find_span_binsearch(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for... | python | def find_span_binsearch(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for... | [
"def",
"find_span_binsearch",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
",",
"knot",
",",
"**",
"kwargs",
")",
":",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"10e-6",
")",
"n",
"=",
"num_ctrlpts",
"-",
"1",
"if",
"abs",
"(",
"... | Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for a knot vector [0, 0, 1, 1];
if FindSpan returns 1, then the knot is between th... | [
"Finds",
"the",
"span",
"of",
"the",
"knot",
"over",
"the",
"input",
"knot",
"vector",
"using",
"binary",
"search",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L20-L68 | train |
orbingol/NURBS-Python | geomdl/helpers.py | find_span_linear | def find_span_linear(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param k... | python | def find_span_linear(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param k... | [
"def",
"find_span_linear",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
",",
"knot",
",",
"**",
"kwargs",
")",
":",
"span",
"=",
"0",
"while",
"span",
"<",
"num_ctrlpts",
"and",
"knot_vector",
"[",
"span",
"]",
"<=",
"knot",
":",
"span",
"+=",
... | Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param... | [
"Finds",
"the",
"span",
"of",
"a",
"single",
"knot",
"over",
"the",
"knot",
"vector",
"using",
"linear",
"search",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L71-L91 | train |
orbingol/NURBS-Python | geomdl/helpers.py | find_spans | def find_spans(degree, knot_vector, num_ctrlpts, knots, func=find_span_linear):
""" Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of con... | python | def find_spans(degree, knot_vector, num_ctrlpts, knots, func=find_span_linear):
""" Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of con... | [
"def",
"find_spans",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
",",
"knots",
",",
"func",
"=",
"find_span_linear",
")",
":",
"spans",
"=",
"[",
"]",
"for",
"knot",
"in",
"knots",
":",
"spans",
".",
"append",
"(",
"func",
"(",
"degree",
","... | Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of control points, :math:`n + 1`
:type num_ctrlpts: int
:param knots: list of knots or... | [
"Finds",
"spans",
"of",
"a",
"list",
"of",
"knots",
"over",
"the",
"knot",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L94-L112 | train |
orbingol/NURBS-Python | geomdl/helpers.py | find_multiplicity | def find_multiplicity(knot, knot_vector, **kwargs):
""" Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type... | python | def find_multiplicity(knot, knot_vector, **kwargs):
""" Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type... | [
"def",
"find_multiplicity",
"(",
"knot",
",",
"knot_vector",
",",
"**",
"kwargs",
")",
":",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"10e-8",
")",
"mult",
"=",
"0",
"for",
"kv",
"in",
"knot_vector",
":",
"if",
"abs",
"(",
"knot",
"-",
"... | Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:return: knot multiplicity, :m... | [
"Finds",
"knot",
"multiplicity",
"over",
"the",
"knot",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L115-L137 | train |
orbingol/NURBS-Python | geomdl/helpers.py | basis_function | def basis_function(degree, knot_vector, span, knot):
""" Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:typ... | python | def basis_function(degree, knot_vector, span, knot):
""" Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:typ... | [
"def",
"basis_function",
"(",
"degree",
",",
"knot_vector",
",",
"span",
",",
"knot",
")",
":",
"left",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",
"]",
"right",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"degr... | Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param span: knot span, :math:... | [
"Computes",
"the",
"non",
"-",
"vanishing",
"basis",
"functions",
"for",
"a",
"single",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L140-L170 | train |
orbingol/NURBS-Python | geomdl/helpers.py | basis_functions | def basis_functions(degree, knot_vector, spans, knots):
""" Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:typ... | python | def basis_functions(degree, knot_vector, spans, knots):
""" Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:typ... | [
"def",
"basis_functions",
"(",
"degree",
",",
"knot_vector",
",",
"spans",
",",
"knots",
")",
":",
"basis",
"=",
"[",
"]",
"for",
"span",
",",
"knot",
"in",
"zip",
"(",
"spans",
",",
"knots",
")",
":",
"basis",
".",
"append",
"(",
"basis_function",
"... | Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:type spans: list, tuple
:param knots: list of knots or paramet... | [
"Computes",
"the",
"non",
"-",
"vanishing",
"basis",
"functions",
"for",
"a",
"list",
"of",
"parameters",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L173-L190 | train |
orbingol/NURBS-Python | geomdl/helpers.py | basis_function_all | def basis_function_all(degree, knot_vector, span, knot):
""" Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: in... | python | def basis_function_all(degree, knot_vector, span, knot):
""" Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: in... | [
"def",
"basis_function_all",
"(",
"degree",
",",
"knot_vector",
",",
"span",
",",
"knot",
")",
":",
"N",
"=",
"[",
"[",
"None",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",
"]",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",... | Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_... | [
"Computes",
"all",
"non",
"-",
"zero",
"basis",
"functions",
"of",
"all",
"degrees",
"from",
"0",
"up",
"to",
"the",
"input",
"degree",
"for",
"a",
"single",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L193-L214 | train |
orbingol/NURBS-Python | geomdl/helpers.py | basis_functions_ders | def basis_functions_ders(degree, knot_vector, spans, knots, order):
""" Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot s... | python | def basis_functions_ders(degree, knot_vector, spans, knots, order):
""" Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot s... | [
"def",
"basis_functions_ders",
"(",
"degree",
",",
"knot_vector",
",",
"spans",
",",
"knots",
",",
"order",
")",
":",
"basis_ders",
"=",
"[",
"]",
"for",
"span",
",",
"knot",
"in",
"zip",
"(",
"spans",
",",
"knots",
")",
":",
"basis_ders",
".",
"append... | Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:type spans: list, tuple
:param knots: list of knots or parame... | [
"Computes",
"derivatives",
"of",
"the",
"basis",
"functions",
"for",
"a",
"list",
"of",
"parameters",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L307-L326 | train |
orbingol/NURBS-Python | geomdl/helpers.py | basis_function_one | def basis_function_one(degree, knot_vector, span, knot):
""" Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vecto... | python | def basis_function_one(degree, knot_vector, span, knot):
""" Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vecto... | [
"def",
"basis_function_one",
"(",
"degree",
",",
"knot_vector",
",",
"span",
",",
"knot",
")",
":",
"if",
"(",
"span",
"==",
"0",
"and",
"knot",
"==",
"knot_vector",
"[",
"0",
"]",
")",
"or",
"(",
"span",
"==",
"len",
"(",
"knot_vector",
")",
"-",
... | Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vector: list, tuple
:param span: knot span, :math:`i`
:type sp... | [
"Computes",
"the",
"value",
"of",
"a",
"basis",
"function",
"for",
"a",
"single",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L329-L381 | train |
orbingol/NURBS-Python | geomdl/visualization/VisMPL.py | VisConfig.set_axes_equal | def set_axes_equal(ax):
""" Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca().
"""
bounds = [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
ranges = [abs(bound[1] - b... | python | def set_axes_equal(ax):
""" Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca().
"""
bounds = [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
ranges = [abs(bound[1] - b... | [
"def",
"set_axes_equal",
"(",
"ax",
")",
":",
"bounds",
"=",
"[",
"ax",
".",
"get_xlim3d",
"(",
")",
",",
"ax",
".",
"get_ylim3d",
"(",
")",
",",
"ax",
".",
"get_zlim3d",
"(",
")",
"]",
"ranges",
"=",
"[",
"abs",
"(",
"bound",
"[",
"1",
"]",
"-... | Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca(). | [
"Sets",
"equal",
"aspect",
"ratio",
"across",
"the",
"three",
"axes",
"of",
"a",
"3D",
"plot",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisMPL.py#L88-L103 | train |
orbingol/NURBS-Python | geomdl/visualization/VisMPL.py | VisSurface.animate | def animate(self, **kwargs):
""" Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps a... | python | def animate(self, **kwargs):
""" Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps a... | [
"def",
"animate",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"super",
"(",
"VisSurface",
",",
"self",
")",
".",
"render",
"(",
"**",
"kwargs",
")",
"surf_cmaps",
"=",
"kwargs",
".",
"get",
"(",
"'colormap'",
",",
"None",
")",
"tri_idxs",
"=",
"[",
... | Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps are a visualization feature of Matplotlib.... | [
"Animates",
"the",
"surface",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisMPL.py#L298-L402 | train |
orbingol/NURBS-Python | geomdl/_operations.py | tangent_curve_single_list | def tangent_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned v... | python | def tangent_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned v... | [
"def",
"tangent_curve_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"tangent_curve_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_ve... | Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
:... | [
"Evaluates",
"the",
"curve",
"tangent",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L41-L57 | train |
orbingol/NURBS-Python | geomdl/_operations.py | normal_curve_single | def normal_curve_single(obj, u, normalize):
""" Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
... | python | def normal_curve_single(obj, u, normalize):
""" Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
... | [
"def",
"normal_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
":",
"ders",
"=",
"obj",
".",
"derivatives",
"(",
"u",
",",
"2",
")",
"point",
"=",
"ders",
"[",
"0",
"]",
"vector",
"=",
"linalg",
".",
"vector_normalize",
"(",
"ders",
"[",
... | Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param obj: input curve
:type obj: abstract... | [
"Evaluates",
"the",
"curve",
"normal",
"vector",
"at",
"the",
"input",
"parameter",
"u",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L60-L81 | train |
orbingol/NURBS-Python | geomdl/_operations.py | normal_curve_single_list | def normal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vec... | python | def normal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vec... | [
"def",
"normal_curve_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"normal_curve_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_vect... | Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
:r... | [
"Evaluates",
"the",
"curve",
"normal",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L84-L100 | train |
orbingol/NURBS-Python | geomdl/_operations.py | binormal_curve_single | def binormal_curve_single(obj, u, normalize):
""" Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param o... | python | def binormal_curve_single(obj, u, normalize):
""" Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param o... | [
"def",
"binormal_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
":",
"tan_vector",
"=",
"tangent_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
"norm_vector",
"=",
"normal_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
... | Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param obj: input curve
:type obj: abstract.Curve
:par... | [
"Evaluates",
"the",
"curve",
"binormal",
"vector",
"at",
"the",
"given",
"u",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L103-L126 | train |
orbingol/NURBS-Python | geomdl/_operations.py | binormal_curve_single_list | def binormal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve binormal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned... | python | def binormal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve binormal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned... | [
"def",
"binormal_curve_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"binormal_curve_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_... | Evaluates the curve binormal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
... | [
"Evaluates",
"the",
"curve",
"binormal",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L129-L145 | train |
orbingol/NURBS-Python | geomdl/_operations.py | tangent_surface_single_list | def tangent_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface tangent vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the re... | python | def tangent_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface tangent vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the re... | [
"def",
"tangent_surface_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"tangent_surface_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"re... | Evaluates the surface tangent vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool... | [
"Evaluates",
"the",
"surface",
"tangent",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L172-L188 | train |
orbingol/NURBS-Python | geomdl/_operations.py | normal_surface_single_list | def normal_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface normal vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the retu... | python | def normal_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface normal vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the retu... | [
"def",
"normal_surface_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"normal_surface_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_... | Evaluates the surface normal vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
... | [
"Evaluates",
"the",
"surface",
"normal",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L215-L231 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.