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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
makinacorpus/landez | landez/tiles.py | ImageExporter.export_image | def export_image(self, bbox, zoomlevel, imagepath):
"""
Writes to ``imagepath`` the tiles for the specified bounding box and zoomlevel.
"""
assert has_pil, _("Cannot export image without python PIL")
grid = self.grid_tiles(bbox, zoomlevel)
width = len(grid[0])
hei... | python | def export_image(self, bbox, zoomlevel, imagepath):
"""
Writes to ``imagepath`` the tiles for the specified bounding box and zoomlevel.
"""
assert has_pil, _("Cannot export image without python PIL")
grid = self.grid_tiles(bbox, zoomlevel)
width = len(grid[0])
hei... | [
"def",
"export_image",
"(",
"self",
",",
"bbox",
",",
"zoomlevel",
",",
"imagepath",
")",
":",
"assert",
"has_pil",
",",
"_",
"(",
"\"Cannot export image without python PIL\"",
")",
"grid",
"=",
"self",
".",
"grid_tiles",
"(",
"bbox",
",",
"zoomlevel",
")",
... | Writes to ``imagepath`` the tiles for the specified bounding box and zoomlevel. | [
"Writes",
"to",
"imagepath",
"the",
"tiles",
"for",
"the",
"specified",
"bounding",
"box",
"and",
"zoomlevel",
"."
] | 6e5c71ded6071158e7943df204cd7bd1ed623a30 | https://github.com/makinacorpus/landez/blob/6e5c71ded6071158e7943df204cd7bd1ed623a30/landez/tiles.py#L426-L445 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _makeScriptOrder | def _makeScriptOrder(gpos):
"""
Run therough GPOS and make an alphabetically
ordered list of scripts. If DFLT is in the list,
move it to the front.
"""
scripts = []
for scriptRecord in gpos.ScriptList.ScriptRecord:
scripts.append(scriptRecord.ScriptTag)
if "DFLT" in scripts:
... | python | def _makeScriptOrder(gpos):
"""
Run therough GPOS and make an alphabetically
ordered list of scripts. If DFLT is in the list,
move it to the front.
"""
scripts = []
for scriptRecord in gpos.ScriptList.ScriptRecord:
scripts.append(scriptRecord.ScriptTag)
if "DFLT" in scripts:
... | [
"def",
"_makeScriptOrder",
"(",
"gpos",
")",
":",
"scripts",
"=",
"[",
"]",
"for",
"scriptRecord",
"in",
"gpos",
".",
"ScriptList",
".",
"ScriptRecord",
":",
"scripts",
".",
"append",
"(",
"scriptRecord",
".",
"ScriptTag",
")",
"if",
"\"DFLT\"",
"in",
"scr... | Run therough GPOS and make an alphabetically
ordered list of scripts. If DFLT is in the list,
move it to the front. | [
"Run",
"therough",
"GPOS",
"and",
"make",
"an",
"alphabetically",
"ordered",
"list",
"of",
"scripts",
".",
"If",
"DFLT",
"is",
"in",
"the",
"list",
"move",
"it",
"to",
"the",
"front",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L408-L420 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _gatherDataFromLookups | def _gatherDataFromLookups(gpos, scriptOrder):
"""
Gather kerning and classes from the applicable lookups
and return them in script order.
"""
lookupIndexes = _gatherLookupIndexes(gpos)
seenLookups = set()
kerningDictionaries = []
leftClassDictionaries = []
rightClassDictionaries = [... | python | def _gatherDataFromLookups(gpos, scriptOrder):
"""
Gather kerning and classes from the applicable lookups
and return them in script order.
"""
lookupIndexes = _gatherLookupIndexes(gpos)
seenLookups = set()
kerningDictionaries = []
leftClassDictionaries = []
rightClassDictionaries = [... | [
"def",
"_gatherDataFromLookups",
"(",
"gpos",
",",
"scriptOrder",
")",
":",
"lookupIndexes",
"=",
"_gatherLookupIndexes",
"(",
"gpos",
")",
"seenLookups",
"=",
"set",
"(",
")",
"kerningDictionaries",
"=",
"[",
"]",
"leftClassDictionaries",
"=",
"[",
"]",
"rightC... | Gather kerning and classes from the applicable lookups
and return them in script order. | [
"Gather",
"kerning",
"and",
"classes",
"from",
"the",
"applicable",
"lookups",
"and",
"return",
"them",
"in",
"script",
"order",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L422-L451 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _handleLookupType2Format1 | def _handleLookupType2Format1(subtable):
"""
Extract a kerning dictionary from a Lookup Type 2 Format 1.
"""
kerning = {}
coverage = subtable.Coverage.glyphs
valueFormat1 = subtable.ValueFormat1
pairSets = subtable.PairSet
for index, leftGlyphName in enumerate(coverage):
pairSet ... | python | def _handleLookupType2Format1(subtable):
"""
Extract a kerning dictionary from a Lookup Type 2 Format 1.
"""
kerning = {}
coverage = subtable.Coverage.glyphs
valueFormat1 = subtable.ValueFormat1
pairSets = subtable.PairSet
for index, leftGlyphName in enumerate(coverage):
pairSet ... | [
"def",
"_handleLookupType2Format1",
"(",
"subtable",
")",
":",
"kerning",
"=",
"{",
"}",
"coverage",
"=",
"subtable",
".",
"Coverage",
".",
"glyphs",
"valueFormat1",
"=",
"subtable",
".",
"ValueFormat1",
"pairSets",
"=",
"subtable",
".",
"PairSet",
"for",
"ind... | Extract a kerning dictionary from a Lookup Type 2 Format 1. | [
"Extract",
"a",
"kerning",
"dictionary",
"from",
"a",
"Lookup",
"Type",
"2",
"Format",
"1",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L553-L572 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _handleLookupType2Format2 | def _handleLookupType2Format2(subtable, lookupIndex, subtableIndex):
"""
Extract kerning, left class and right class dictionaries from a Lookup Type 2 Format 2.
"""
# extract the classes
leftClasses = _extractFeatureClasses(lookupIndex=lookupIndex, subtableIndex=subtableIndex, classDefs=subtable.Cla... | python | def _handleLookupType2Format2(subtable, lookupIndex, subtableIndex):
"""
Extract kerning, left class and right class dictionaries from a Lookup Type 2 Format 2.
"""
# extract the classes
leftClasses = _extractFeatureClasses(lookupIndex=lookupIndex, subtableIndex=subtableIndex, classDefs=subtable.Cla... | [
"def",
"_handleLookupType2Format2",
"(",
"subtable",
",",
"lookupIndex",
",",
"subtableIndex",
")",
":",
"leftClasses",
"=",
"_extractFeatureClasses",
"(",
"lookupIndex",
"=",
"lookupIndex",
",",
"subtableIndex",
"=",
"subtableIndex",
",",
"classDefs",
"=",
"subtable"... | Extract kerning, left class and right class dictionaries from a Lookup Type 2 Format 2. | [
"Extract",
"kerning",
"left",
"class",
"and",
"right",
"class",
"dictionaries",
"from",
"a",
"Lookup",
"Type",
"2",
"Format",
"2",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L574-L595 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _mergeKerningDictionaries | def _mergeKerningDictionaries(kerningDictionaries):
"""
Merge all of the kerning dictionaries found into
one flat dictionary.
"""
# work through the dictionaries backwards since
# this uses an update to load the kerning. this
# will ensure that the script order is honored.
kerning = {}
... | python | def _mergeKerningDictionaries(kerningDictionaries):
"""
Merge all of the kerning dictionaries found into
one flat dictionary.
"""
# work through the dictionaries backwards since
# this uses an update to load the kerning. this
# will ensure that the script order is honored.
kerning = {}
... | [
"def",
"_mergeKerningDictionaries",
"(",
"kerningDictionaries",
")",
":",
"kerning",
"=",
"{",
"}",
"for",
"dictionaryGroup",
"in",
"reversed",
"(",
"kerningDictionaries",
")",
":",
"for",
"dictionary",
"in",
"dictionaryGroup",
":",
"kerning",
".",
"update",
"(",
... | Merge all of the kerning dictionaries found into
one flat dictionary. | [
"Merge",
"all",
"of",
"the",
"kerning",
"dictionaries",
"found",
"into",
"one",
"flat",
"dictionary",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L597-L610 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _findSingleMemberGroups | def _findSingleMemberGroups(classDictionaries):
"""
Find all classes that have only one member.
"""
toRemove = {}
for classDictionaryGroup in classDictionaries:
for classDictionary in classDictionaryGroup:
for name, members in list(classDictionary.items()):
if len... | python | def _findSingleMemberGroups(classDictionaries):
"""
Find all classes that have only one member.
"""
toRemove = {}
for classDictionaryGroup in classDictionaries:
for classDictionary in classDictionaryGroup:
for name, members in list(classDictionary.items()):
if len... | [
"def",
"_findSingleMemberGroups",
"(",
"classDictionaries",
")",
":",
"toRemove",
"=",
"{",
"}",
"for",
"classDictionaryGroup",
"in",
"classDictionaries",
":",
"for",
"classDictionary",
"in",
"classDictionaryGroup",
":",
"for",
"name",
",",
"members",
"in",
"list",
... | Find all classes that have only one member. | [
"Find",
"all",
"classes",
"that",
"have",
"only",
"one",
"member",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L612-L623 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _removeSingleMemberGroupReferences | def _removeSingleMemberGroupReferences(kerning, leftGroups, rightGroups):
"""
Translate group names into glyph names in pairs
if the group only contains one glyph.
"""
new = {}
for (left, right), value in kerning.items():
left = leftGroups.get(left, left)
right = rightGroups.get(... | python | def _removeSingleMemberGroupReferences(kerning, leftGroups, rightGroups):
"""
Translate group names into glyph names in pairs
if the group only contains one glyph.
"""
new = {}
for (left, right), value in kerning.items():
left = leftGroups.get(left, left)
right = rightGroups.get(... | [
"def",
"_removeSingleMemberGroupReferences",
"(",
"kerning",
",",
"leftGroups",
",",
"rightGroups",
")",
":",
"new",
"=",
"{",
"}",
"for",
"(",
"left",
",",
"right",
")",
",",
"value",
"in",
"kerning",
".",
"items",
"(",
")",
":",
"left",
"=",
"leftGroup... | Translate group names into glyph names in pairs
if the group only contains one glyph. | [
"Translate",
"group",
"names",
"into",
"glyph",
"names",
"in",
"pairs",
"if",
"the",
"group",
"only",
"contains",
"one",
"glyph",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L625-L635 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _setGroupNames | def _setGroupNames(classes, classRename):
"""
Set the final names into the groups.
"""
groups = {}
for groupName, glyphList in classes.items():
groupName = classRename.get(groupName, groupName)
# if the glyph list has only one member,
# the glyph name will be used in the pair... | python | def _setGroupNames(classes, classRename):
"""
Set the final names into the groups.
"""
groups = {}
for groupName, glyphList in classes.items():
groupName = classRename.get(groupName, groupName)
# if the glyph list has only one member,
# the glyph name will be used in the pair... | [
"def",
"_setGroupNames",
"(",
"classes",
",",
"classRename",
")",
":",
"groups",
"=",
"{",
"}",
"for",
"groupName",
",",
"glyphList",
"in",
"classes",
".",
"items",
"(",
")",
":",
"groupName",
"=",
"classRename",
".",
"get",
"(",
"groupName",
",",
"group... | Set the final names into the groups. | [
"Set",
"the",
"final",
"names",
"into",
"the",
"groups",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L672-L685 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _validateClasses | def _validateClasses(classes):
"""
Check to make sure that a glyph is not part of more than
one class. If this is found, an ExtractorError is raised.
"""
glyphToClass = {}
for className, glyphList in classes.items():
for glyphName in glyphList:
if glyphName not in glyphToClas... | python | def _validateClasses(classes):
"""
Check to make sure that a glyph is not part of more than
one class. If this is found, an ExtractorError is raised.
"""
glyphToClass = {}
for className, glyphList in classes.items():
for glyphName in glyphList:
if glyphName not in glyphToClas... | [
"def",
"_validateClasses",
"(",
"classes",
")",
":",
"glyphToClass",
"=",
"{",
"}",
"for",
"className",
",",
"glyphList",
"in",
"classes",
".",
"items",
"(",
")",
":",
"for",
"glyphName",
"in",
"glyphList",
":",
"if",
"glyphName",
"not",
"in",
"glyphToClas... | Check to make sure that a glyph is not part of more than
one class. If this is found, an ExtractorError is raised. | [
"Check",
"to",
"make",
"sure",
"that",
"a",
"glyph",
"is",
"not",
"part",
"of",
"more",
"than",
"one",
"class",
".",
"If",
"this",
"is",
"found",
"an",
"ExtractorError",
"is",
"raised",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L687-L700 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _replaceRenamedPairMembers | def _replaceRenamedPairMembers(kerning, leftRename, rightRename):
"""
Populate the renamed pair members into the kerning.
"""
renamedKerning = {}
for (left, right), value in kerning.items():
left = leftRename.get(left, left)
right = rightRename.get(right, right)
renamedKernin... | python | def _replaceRenamedPairMembers(kerning, leftRename, rightRename):
"""
Populate the renamed pair members into the kerning.
"""
renamedKerning = {}
for (left, right), value in kerning.items():
left = leftRename.get(left, left)
right = rightRename.get(right, right)
renamedKernin... | [
"def",
"_replaceRenamedPairMembers",
"(",
"kerning",
",",
"leftRename",
",",
"rightRename",
")",
":",
"renamedKerning",
"=",
"{",
"}",
"for",
"(",
"left",
",",
"right",
")",
",",
"value",
"in",
"kerning",
".",
"items",
"(",
")",
":",
"left",
"=",
"leftRe... | Populate the renamed pair members into the kerning. | [
"Populate",
"the",
"renamed",
"pair",
"members",
"into",
"the",
"kerning",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L702-L711 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _renameClasses | def _renameClasses(classes, prefix):
"""
Replace class IDs with nice strings.
"""
renameMap = {}
for classID, glyphList in classes.items():
if len(glyphList) == 0:
groupName = "%s_empty_lu.%d_st.%d_cl.%d" % (prefix, classID[0], classID[1], classID[2])
elif len(glyphList) ... | python | def _renameClasses(classes, prefix):
"""
Replace class IDs with nice strings.
"""
renameMap = {}
for classID, glyphList in classes.items():
if len(glyphList) == 0:
groupName = "%s_empty_lu.%d_st.%d_cl.%d" % (prefix, classID[0], classID[1], classID[2])
elif len(glyphList) ... | [
"def",
"_renameClasses",
"(",
"classes",
",",
"prefix",
")",
":",
"renameMap",
"=",
"{",
"}",
"for",
"classID",
",",
"glyphList",
"in",
"classes",
".",
"items",
"(",
")",
":",
"if",
"len",
"(",
"glyphList",
")",
"==",
"0",
":",
"groupName",
"=",
"\"%... | Replace class IDs with nice strings. | [
"Replace",
"class",
"IDs",
"with",
"nice",
"strings",
"."
] | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L713-L727 | train |
robotools/extractor | Lib/extractor/formats/opentype.py | _extractFeatureClasses | def _extractFeatureClasses(lookupIndex, subtableIndex, classDefs, coverage=None):
"""
Extract classes for a specific lookup in a specific subtable.
This is relatively straightforward, except for class 0 interpretation.
Some fonts don't have class 0. Some fonts have a list of class
members that are c... | python | def _extractFeatureClasses(lookupIndex, subtableIndex, classDefs, coverage=None):
"""
Extract classes for a specific lookup in a specific subtable.
This is relatively straightforward, except for class 0 interpretation.
Some fonts don't have class 0. Some fonts have a list of class
members that are c... | [
"def",
"_extractFeatureClasses",
"(",
"lookupIndex",
",",
"subtableIndex",
",",
"classDefs",
",",
"coverage",
"=",
"None",
")",
":",
"classDict",
"=",
"{",
"}",
"for",
"glyphName",
",",
"classIndex",
"in",
"classDefs",
".",
"items",
"(",
")",
":",
"if",
"c... | Extract classes for a specific lookup in a specific subtable.
This is relatively straightforward, except for class 0 interpretation.
Some fonts don't have class 0. Some fonts have a list of class
members that are clearly not all to be used in kerning pairs.
In the case of a missing class 0, the coverage... | [
"Extract",
"classes",
"for",
"a",
"specific",
"lookup",
"in",
"a",
"specific",
"subtable",
".",
"This",
"is",
"relatively",
"straightforward",
"except",
"for",
"class",
"0",
"interpretation",
".",
"Some",
"fonts",
"don",
"t",
"have",
"class",
"0",
".",
"Some... | da3c2c92bfd3da863dd5de29bd8bc94cbbf433df | https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L729-L762 | train |
thriftrw/thriftrw-python | thriftrw/compile/compiler.py | ModuleSpec.add_include | def add_include(self, name, module_spec):
"""Adds a module as an included module.
:param name:
Name under which the included module should be exposed in the
current module.
:param module_spec:
ModuleSpec of the included module.
"""
assert name... | python | def add_include(self, name, module_spec):
"""Adds a module as an included module.
:param name:
Name under which the included module should be exposed in the
current module.
:param module_spec:
ModuleSpec of the included module.
"""
assert name... | [
"def",
"add_include",
"(",
"self",
",",
"name",
",",
"module_spec",
")",
":",
"assert",
"name",
",",
"'name is required'",
"assert",
"self",
".",
"can_include",
"if",
"name",
"in",
"self",
".",
"includes",
":",
"raise",
"ThriftCompilerError",
"(",
"'Cannot inc... | Adds a module as an included module.
:param name:
Name under which the included module should be exposed in the
current module.
:param module_spec:
ModuleSpec of the included module. | [
"Adds",
"a",
"module",
"as",
"an",
"included",
"module",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/compiler.py#L90-L110 | train |
thriftrw/thriftrw-python | thriftrw/compile/compiler.py | ModuleSpec.link | def link(self):
"""Link all the types in this module and all included modules."""
if self.linked:
return self
self.linked = True
included_modules = []
# Link includes
for include in self.includes.values():
included_modules.append(include.link().... | python | def link(self):
"""Link all the types in this module and all included modules."""
if self.linked:
return self
self.linked = True
included_modules = []
# Link includes
for include in self.includes.values():
included_modules.append(include.link().... | [
"def",
"link",
"(",
"self",
")",
":",
"if",
"self",
".",
"linked",
":",
"return",
"self",
"self",
".",
"linked",
"=",
"True",
"included_modules",
"=",
"[",
"]",
"for",
"include",
"in",
"self",
".",
"includes",
".",
"values",
"(",
")",
":",
"included_... | Link all the types in this module and all included modules. | [
"Link",
"all",
"the",
"types",
"in",
"this",
"module",
"and",
"all",
"included",
"modules",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/compiler.py#L112-L135 | train |
thriftrw/thriftrw-python | thriftrw/compile/compiler.py | Compiler.compile | def compile(self, name, contents, path=None):
"""Compile the given Thrift document into a Python module.
The generated module contains,
.. py:attribute:: __services__
A collection of generated classes for all services defined in the
thrift file.
.. version... | python | def compile(self, name, contents, path=None):
"""Compile the given Thrift document into a Python module.
The generated module contains,
.. py:attribute:: __services__
A collection of generated classes for all services defined in the
thrift file.
.. version... | [
"def",
"compile",
"(",
"self",
",",
"name",
",",
"contents",
",",
"path",
"=",
"None",
")",
":",
"assert",
"name",
"if",
"path",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"if",
"path",
"in",
"self",
".",
"_module_specs"... | Compile the given Thrift document into a Python module.
The generated module contains,
.. py:attribute:: __services__
A collection of generated classes for all services defined in the
thrift file.
.. versionchanged:: 1.0
Renamed from ``services`` ... | [
"Compile",
"the",
"given",
"Thrift",
"document",
"into",
"a",
"Python",
"module",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/compiler.py#L164-L278 | train |
thriftrw/thriftrw-python | thriftrw/idl/lexer.py | Lexer.input | def input(self, data):
"""Reset the lexer and feed in new input.
:param data:
String of input data.
"""
# input(..) doesn't reset the lineno. We have to do that manually.
self._lexer.lineno = 1
return self._lexer.input(data) | python | def input(self, data):
"""Reset the lexer and feed in new input.
:param data:
String of input data.
"""
# input(..) doesn't reset the lineno. We have to do that manually.
self._lexer.lineno = 1
return self._lexer.input(data) | [
"def",
"input",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_lexer",
".",
"lineno",
"=",
"1",
"return",
"self",
".",
"_lexer",
".",
"input",
"(",
"data",
")"
] | Reset the lexer and feed in new input.
:param data:
String of input data. | [
"Reset",
"the",
"lexer",
"and",
"feed",
"in",
"new",
"input",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/idl/lexer.py#L169-L177 | train |
Spinmob/spinmob | egg/example_sweeper.py | get_data | def get_data():
"""
Currently pretends to talk to an instrument and get back the magnitud
and phase of the measurement.
"""
# pretend we're measuring a noisy resonance at zero
y = 1.0 / (1.0 + 1j*(n_x.get_value()-0.002)*1000) + _n.random.rand()*0.1
# and that it takes time to do so
_t.... | python | def get_data():
"""
Currently pretends to talk to an instrument and get back the magnitud
and phase of the measurement.
"""
# pretend we're measuring a noisy resonance at zero
y = 1.0 / (1.0 + 1j*(n_x.get_value()-0.002)*1000) + _n.random.rand()*0.1
# and that it takes time to do so
_t.... | [
"def",
"get_data",
"(",
")",
":",
"y",
"=",
"1.0",
"/",
"(",
"1.0",
"+",
"1j",
"*",
"(",
"n_x",
".",
"get_value",
"(",
")",
"-",
"0.002",
")",
"*",
"1000",
")",
"+",
"_n",
".",
"random",
".",
"rand",
"(",
")",
"*",
"0.1",
"_t",
".",
"sleep"... | Currently pretends to talk to an instrument and get back the magnitud
and phase of the measurement. | [
"Currently",
"pretends",
"to",
"talk",
"to",
"an",
"instrument",
"and",
"get",
"back",
"the",
"magnitud",
"and",
"phase",
"of",
"the",
"measurement",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/example_sweeper.py#L61-L74 | train |
Spinmob/spinmob | _settings.py | settings.List | def List(self):
"""
Lists the keys and values.
"""
print()
for key in list(self.keys()):
print(key,'=',self[key])
print() | python | def List(self):
"""
Lists the keys and values.
"""
print()
for key in list(self.keys()):
print(key,'=',self[key])
print() | [
"def",
"List",
"(",
"self",
")",
":",
"print",
"(",
")",
"for",
"key",
"in",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
":",
"print",
"(",
"key",
",",
"'='",
",",
"self",
"[",
"key",
"]",
")",
"print",
"(",
")"
] | Lists the keys and values. | [
"Lists",
"the",
"keys",
"and",
"values",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_settings.py#L67-L74 | train |
Spinmob/spinmob | _settings.py | settings.Set | def Set(self, key, value):
"""
Sets the key-value pair and dumps to the preferences file.
"""
if not value == None: self.prefs[key] = value
else: self.prefs.pop(key)
self.Dump() | python | def Set(self, key, value):
"""
Sets the key-value pair and dumps to the preferences file.
"""
if not value == None: self.prefs[key] = value
else: self.prefs.pop(key)
self.Dump() | [
"def",
"Set",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"not",
"value",
"==",
"None",
":",
"self",
".",
"prefs",
"[",
"key",
"]",
"=",
"value",
"else",
":",
"self",
".",
"prefs",
".",
"pop",
"(",
"key",
")",
"self",
".",
"Dump",
... | Sets the key-value pair and dumps to the preferences file. | [
"Sets",
"the",
"key",
"-",
"value",
"pair",
"and",
"dumps",
"to",
"the",
"preferences",
"file",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_settings.py#L85-L92 | train |
Spinmob/spinmob | _settings.py | settings.MakeDir | def MakeDir(self, path="temp"):
"""
Creates a directory of the specified path in the .spinmob directory.
"""
full_path = _os.path.join(self.path_home, path)
# only make it if it doesn't exist!
if not _os.path.exists(full_path): _os.makedirs(full_path) | python | def MakeDir(self, path="temp"):
"""
Creates a directory of the specified path in the .spinmob directory.
"""
full_path = _os.path.join(self.path_home, path)
# only make it if it doesn't exist!
if not _os.path.exists(full_path): _os.makedirs(full_path) | [
"def",
"MakeDir",
"(",
"self",
",",
"path",
"=",
"\"temp\"",
")",
":",
"full_path",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path_home",
",",
"path",
")",
"if",
"not",
"_os",
".",
"path",
".",
"exists",
"(",
"full_path",
")",
":",
... | Creates a directory of the specified path in the .spinmob directory. | [
"Creates",
"a",
"directory",
"of",
"the",
"specified",
"path",
"in",
"the",
".",
"spinmob",
"directory",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_settings.py#L106-L113 | train |
thriftrw/thriftrw-python | thriftrw/idl/parser.py | ParserSpec._parse_seq | def _parse_seq(self, p):
"""Helper to parse sequence rules.
Sequence rules are in the form::
foo : foo_item sep foo
| foo_item foo
|
This function builds a deque of the items in-order.
If the number of tokens doesn't match, an exception is ... | python | def _parse_seq(self, p):
"""Helper to parse sequence rules.
Sequence rules are in the form::
foo : foo_item sep foo
| foo_item foo
|
This function builds a deque of the items in-order.
If the number of tokens doesn't match, an exception is ... | [
"def",
"_parse_seq",
"(",
"self",
",",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
"==",
"4",
":",
"p",
"[",
"3",
"]",
".",
"appendleft",
"(",
"p",
"[",
"1",
"]",
")",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"3",
"]",
"elif",
"len",
"(",
"p",... | Helper to parse sequence rules.
Sequence rules are in the form::
foo : foo_item sep foo
| foo_item foo
|
This function builds a deque of the items in-order.
If the number of tokens doesn't match, an exception is raised. | [
"Helper",
"to",
"parse",
"sequence",
"rules",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/idl/parser.py#L413-L445 | train |
thriftrw/thriftrw-python | thriftrw/idl/parser.py | Parser.parse | def parse(self, input, **kwargs):
"""Parse the given input.
:param input:
String containing the text to be parsed.
:raises thriftrw.errors.ThriftParserError:
For parsing errors.
"""
return self._parser.parse(input, lexer=self._lexer, **kwargs) | python | def parse(self, input, **kwargs):
"""Parse the given input.
:param input:
String containing the text to be parsed.
:raises thriftrw.errors.ThriftParserError:
For parsing errors.
"""
return self._parser.parse(input, lexer=self._lexer, **kwargs) | [
"def",
"parse",
"(",
"self",
",",
"input",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"_parser",
".",
"parse",
"(",
"input",
",",
"lexer",
"=",
"self",
".",
"_lexer",
",",
"**",
"kwargs",
")"
] | Parse the given input.
:param input:
String containing the text to be parsed.
:raises thriftrw.errors.ThriftParserError:
For parsing errors. | [
"Parse",
"the",
"given",
"input",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/idl/parser.py#L460-L468 | train |
Spinmob/spinmob | egg/example_other_widgets.py | acquire_fake_data | def acquire_fake_data(number_of_points=1000):
"""
This function generates some fake data and returns two channels of data
in the form
time_array, [channel1, channel2]
"""
# time array
t = _n.linspace(0,10,number_of_points)
return(t, [_n.cos(t)*(1.0+0.2*_n.random.random(number_of_points... | python | def acquire_fake_data(number_of_points=1000):
"""
This function generates some fake data and returns two channels of data
in the form
time_array, [channel1, channel2]
"""
# time array
t = _n.linspace(0,10,number_of_points)
return(t, [_n.cos(t)*(1.0+0.2*_n.random.random(number_of_points... | [
"def",
"acquire_fake_data",
"(",
"number_of_points",
"=",
"1000",
")",
":",
"t",
"=",
"_n",
".",
"linspace",
"(",
"0",
",",
"10",
",",
"number_of_points",
")",
"return",
"(",
"t",
",",
"[",
"_n",
".",
"cos",
"(",
"t",
")",
"*",
"(",
"1.0",
"+",
"... | This function generates some fake data and returns two channels of data
in the form
time_array, [channel1, channel2] | [
"This",
"function",
"generates",
"some",
"fake",
"data",
"and",
"returns",
"two",
"channels",
"of",
"data",
"in",
"the",
"form"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/example_other_widgets.py#L90-L101 | train |
Spinmob/spinmob | _data.py | load | def load(path=None, first_data_line='auto', filters='*.*', text='Select a file, FACEHEAD.', default_directory='default_directory', quiet=True, header_only=False, transpose=False, **kwargs):
"""
Loads a data file into the databox data class. Returns the data object.
Most keyword arguments are sent to databo... | python | def load(path=None, first_data_line='auto', filters='*.*', text='Select a file, FACEHEAD.', default_directory='default_directory', quiet=True, header_only=False, transpose=False, **kwargs):
"""
Loads a data file into the databox data class. Returns the data object.
Most keyword arguments are sent to databo... | [
"def",
"load",
"(",
"path",
"=",
"None",
",",
"first_data_line",
"=",
"'auto'",
",",
"filters",
"=",
"'*.*'",
",",
"text",
"=",
"'Select a file, FACEHEAD.'",
",",
"default_directory",
"=",
"'default_directory'",
",",
"quiet",
"=",
"True",
",",
"header_only",
"... | Loads a data file into the databox data class. Returns the data object.
Most keyword arguments are sent to databox.load() so check there
for documentation.(if their function isn't obvious).
Parameters
----------
path=None
Supply a path to a data file; None means use a dialog.
first_dat... | [
"Loads",
"a",
"data",
"file",
"into",
"the",
"databox",
"data",
"class",
".",
"Returns",
"the",
"data",
"object",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L3013-L3051 | train |
Spinmob/spinmob | _data.py | databox.more_info | def more_info(self):
"""
Prints out more information about the databox.
"""
print("\nDatabox Instance", self.path)
print("\nHeader")
for h in self.hkeys: print(" "+h+":", self.h(h))
s = "\nColumns ("+str(len(self.ckeys))+"): "
for c in self.ckeys: s = s+c... | python | def more_info(self):
"""
Prints out more information about the databox.
"""
print("\nDatabox Instance", self.path)
print("\nHeader")
for h in self.hkeys: print(" "+h+":", self.h(h))
s = "\nColumns ("+str(len(self.ckeys))+"): "
for c in self.ckeys: s = s+c... | [
"def",
"more_info",
"(",
"self",
")",
":",
"print",
"(",
"\"\\nDatabox Instance\"",
",",
"self",
".",
"path",
")",
"print",
"(",
"\"\\nHeader\"",
")",
"for",
"h",
"in",
"self",
".",
"hkeys",
":",
"print",
"(",
"\" \"",
"+",
"h",
"+",
"\":\"",
",",
"... | Prints out more information about the databox. | [
"Prints",
"out",
"more",
"information",
"about",
"the",
"databox",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L101-L110 | train |
Spinmob/spinmob | _data.py | databox.execute_script | def execute_script(self, script, g=None):
"""
Runs a script, returning the result.
Parameters
----------
script
String script to be evaluated (see below).
g=None
Optional dictionary of additional globals for the script evaluation.
Thes... | python | def execute_script(self, script, g=None):
"""
Runs a script, returning the result.
Parameters
----------
script
String script to be evaluated (see below).
g=None
Optional dictionary of additional globals for the script evaluation.
Thes... | [
"def",
"execute_script",
"(",
"self",
",",
"script",
",",
"g",
"=",
"None",
")",
":",
"if",
"not",
"g",
"==",
"None",
":",
"self",
".",
"extra_globals",
".",
"update",
"(",
"g",
")",
"if",
"not",
"_s",
".",
"fun",
".",
"is_iterable",
"(",
"script",... | Runs a script, returning the result.
Parameters
----------
script
String script to be evaluated (see below).
g=None
Optional dictionary of additional globals for the script evaluation.
These will automatically be inserted into self.extra_globals.
... | [
"Runs",
"a",
"script",
"returning",
"the",
"result",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L702-L772 | train |
Spinmob/spinmob | _data.py | databox.copy_headers | def copy_headers(self, source_databox):
"""
Loops over the hkeys of the source_databox, updating this databoxes' header.
"""
for k in source_databox.hkeys: self.insert_header(k, source_databox.h(k))
return self | python | def copy_headers(self, source_databox):
"""
Loops over the hkeys of the source_databox, updating this databoxes' header.
"""
for k in source_databox.hkeys: self.insert_header(k, source_databox.h(k))
return self | [
"def",
"copy_headers",
"(",
"self",
",",
"source_databox",
")",
":",
"for",
"k",
"in",
"source_databox",
".",
"hkeys",
":",
"self",
".",
"insert_header",
"(",
"k",
",",
"source_databox",
".",
"h",
"(",
"k",
")",
")",
"return",
"self"
] | Loops over the hkeys of the source_databox, updating this databoxes' header. | [
"Loops",
"over",
"the",
"hkeys",
"of",
"the",
"source_databox",
"updating",
"this",
"databoxes",
"header",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L880-L886 | train |
Spinmob/spinmob | _data.py | databox.copy_columns | def copy_columns(self, source_databox):
"""
Loops over the ckeys of the source_databox, updating this databoxes' columns.
"""
for k in source_databox.ckeys: self.insert_column(source_databox[k], k)
return self | python | def copy_columns(self, source_databox):
"""
Loops over the ckeys of the source_databox, updating this databoxes' columns.
"""
for k in source_databox.ckeys: self.insert_column(source_databox[k], k)
return self | [
"def",
"copy_columns",
"(",
"self",
",",
"source_databox",
")",
":",
"for",
"k",
"in",
"source_databox",
".",
"ckeys",
":",
"self",
".",
"insert_column",
"(",
"source_databox",
"[",
"k",
"]",
",",
"k",
")",
"return",
"self"
] | Loops over the ckeys of the source_databox, updating this databoxes' columns. | [
"Loops",
"over",
"the",
"ckeys",
"of",
"the",
"source_databox",
"updating",
"this",
"databoxes",
"columns",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L888-L894 | train |
Spinmob/spinmob | _data.py | databox.copy_all | def copy_all(self, source_databox):
"""
Copies the header and columns from source_databox to this databox.
"""
self.copy_headers(source_databox)
self.copy_columns(source_databox)
return self | python | def copy_all(self, source_databox):
"""
Copies the header and columns from source_databox to this databox.
"""
self.copy_headers(source_databox)
self.copy_columns(source_databox)
return self | [
"def",
"copy_all",
"(",
"self",
",",
"source_databox",
")",
":",
"self",
".",
"copy_headers",
"(",
"source_databox",
")",
"self",
".",
"copy_columns",
"(",
"source_databox",
")",
"return",
"self"
] | Copies the header and columns from source_databox to this databox. | [
"Copies",
"the",
"header",
"and",
"columns",
"from",
"source_databox",
"to",
"this",
"databox",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L896-L902 | train |
Spinmob/spinmob | _data.py | databox.insert_globals | def insert_globals(self, *args, **kwargs):
"""
Appends or overwrites the supplied object in the self.extra_globals.
Use this to expose execute_script() or _parse_script() etc... to external
objects and functions.
Regular arguments are assumed to have a __name__ attribute (as is... | python | def insert_globals(self, *args, **kwargs):
"""
Appends or overwrites the supplied object in the self.extra_globals.
Use this to expose execute_script() or _parse_script() etc... to external
objects and functions.
Regular arguments are assumed to have a __name__ attribute (as is... | [
"def",
"insert_globals",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"for",
"a",
"in",
"args",
":",
"kwargs",
"[",
"a",
".",
"__name__",
"]",
"=",
"a",
"self",
".",
"extra_globals",
".",
"update",
"(",
"kwargs",
")"
] | Appends or overwrites the supplied object in the self.extra_globals.
Use this to expose execute_script() or _parse_script() etc... to external
objects and functions.
Regular arguments are assumed to have a __name__ attribute (as is the
case for functions) to use as the key, and keyword... | [
"Appends",
"or",
"overwrites",
"the",
"supplied",
"object",
"in",
"the",
"self",
".",
"extra_globals",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L904-L916 | train |
Spinmob/spinmob | _data.py | databox.pop_header | def pop_header(self, hkey, ignore_error=False):
"""
This will remove and return the specified header value.
Parameters
----------
hkey
Header key you wish to pop.
You can specify either a key string or an index.
ignore_error=False
Whe... | python | def pop_header(self, hkey, ignore_error=False):
"""
This will remove and return the specified header value.
Parameters
----------
hkey
Header key you wish to pop.
You can specify either a key string or an index.
ignore_error=False
Whe... | [
"def",
"pop_header",
"(",
"self",
",",
"hkey",
",",
"ignore_error",
"=",
"False",
")",
":",
"if",
"type",
"(",
"hkey",
")",
"is",
"not",
"str",
":",
"try",
":",
"return",
"self",
".",
"headers",
".",
"pop",
"(",
"self",
".",
"hkeys",
".",
"pop",
... | This will remove and return the specified header value.
Parameters
----------
hkey
Header key you wish to pop.
You can specify either a key string or an index.
ignore_error=False
Whether to quietly ignore any errors (i.e., hkey not found). | [
"This",
"will",
"remove",
"and",
"return",
"the",
"specified",
"header",
"value",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1022-L1055 | train |
Spinmob/spinmob | _data.py | databox.pop_column | def pop_column(self, ckey):
"""
This will remove and return the data in the specified column.
You can specify either a key string or an index.
"""
# try the integer approach first to allow negative values
if type(ckey) is not str:
return self.columns.pop(sel... | python | def pop_column(self, ckey):
"""
This will remove and return the data in the specified column.
You can specify either a key string or an index.
"""
# try the integer approach first to allow negative values
if type(ckey) is not str:
return self.columns.pop(sel... | [
"def",
"pop_column",
"(",
"self",
",",
"ckey",
")",
":",
"if",
"type",
"(",
"ckey",
")",
"is",
"not",
"str",
":",
"return",
"self",
".",
"columns",
".",
"pop",
"(",
"self",
".",
"ckeys",
".",
"pop",
"(",
"ckey",
")",
")",
"else",
":",
"ckey",
"... | This will remove and return the data in the specified column.
You can specify either a key string or an index. | [
"This",
"will",
"remove",
"and",
"return",
"the",
"data",
"in",
"the",
"specified",
"column",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1059-L1079 | train |
Spinmob/spinmob | _data.py | databox.rename_header | def rename_header(self, old_name, new_name):
"""
This will rename the header. The supplied names need to be strings.
"""
self.hkeys[self.hkeys.index(old_name)] = new_name
self.headers[new_name] = self.headers.pop(old_name)
return self | python | def rename_header(self, old_name, new_name):
"""
This will rename the header. The supplied names need to be strings.
"""
self.hkeys[self.hkeys.index(old_name)] = new_name
self.headers[new_name] = self.headers.pop(old_name)
return self | [
"def",
"rename_header",
"(",
"self",
",",
"old_name",
",",
"new_name",
")",
":",
"self",
".",
"hkeys",
"[",
"self",
".",
"hkeys",
".",
"index",
"(",
"old_name",
")",
"]",
"=",
"new_name",
"self",
".",
"headers",
"[",
"new_name",
"]",
"=",
"self",
"."... | This will rename the header. The supplied names need to be strings. | [
"This",
"will",
"rename",
"the",
"header",
".",
"The",
"supplied",
"names",
"need",
"to",
"be",
"strings",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1153-L1159 | train |
Spinmob/spinmob | _data.py | databox.rename_column | def rename_column(self, column, new_name):
"""
This will rename the column.
The supplied column can be an integer or the old column name.
"""
if type(column) is not str: column = self.ckeys[column]
self.ckeys[self.ckeys.index(column)] = new_name
self.columns[new_n... | python | def rename_column(self, column, new_name):
"""
This will rename the column.
The supplied column can be an integer or the old column name.
"""
if type(column) is not str: column = self.ckeys[column]
self.ckeys[self.ckeys.index(column)] = new_name
self.columns[new_n... | [
"def",
"rename_column",
"(",
"self",
",",
"column",
",",
"new_name",
")",
":",
"if",
"type",
"(",
"column",
")",
"is",
"not",
"str",
":",
"column",
"=",
"self",
".",
"ckeys",
"[",
"column",
"]",
"self",
".",
"ckeys",
"[",
"self",
".",
"ckeys",
".",... | This will rename the column.
The supplied column can be an integer or the old column name. | [
"This",
"will",
"rename",
"the",
"column",
".",
"The",
"supplied",
"column",
"can",
"be",
"an",
"integer",
"or",
"the",
"old",
"column",
"name",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1161-L1169 | train |
Spinmob/spinmob | _data.py | databox.transpose | def transpose(self):
"""
Returns a copy of this databox with the columns as rows.
Currently requires that the databox has equal-length columns.
"""
# Create an empty databox with the same headers and delimiter.
d = databox(delimter=self.delimiter)
self.co... | python | def transpose(self):
"""
Returns a copy of this databox with the columns as rows.
Currently requires that the databox has equal-length columns.
"""
# Create an empty databox with the same headers and delimiter.
d = databox(delimter=self.delimiter)
self.co... | [
"def",
"transpose",
"(",
"self",
")",
":",
"d",
"=",
"databox",
"(",
"delimter",
"=",
"self",
".",
"delimiter",
")",
"self",
".",
"copy_headers",
"(",
"d",
")",
"z",
"=",
"_n",
".",
"array",
"(",
"self",
"[",
":",
"]",
")",
".",
"transpose",
"(",... | Returns a copy of this databox with the columns as rows.
Currently requires that the databox has equal-length columns. | [
"Returns",
"a",
"copy",
"of",
"this",
"databox",
"with",
"the",
"columns",
"as",
"rows",
".",
"Currently",
"requires",
"that",
"the",
"databox",
"has",
"equal",
"-",
"length",
"columns",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1202-L1218 | train |
Spinmob/spinmob | _data.py | fitter._update_functions | def _update_functions(self):
"""
Uses internal settings to update the functions.
"""
self.f = []
self.bg = []
self._fnames = []
self._bgnames = []
self._odr_models = [] # Like f, but different parameters, for use in ODR... | python | def _update_functions(self):
"""
Uses internal settings to update the functions.
"""
self.f = []
self.bg = []
self._fnames = []
self._bgnames = []
self._odr_models = [] # Like f, but different parameters, for use in ODR... | [
"def",
"_update_functions",
"(",
"self",
")",
":",
"self",
".",
"f",
"=",
"[",
"]",
"self",
".",
"bg",
"=",
"[",
"]",
"self",
".",
"_fnames",
"=",
"[",
"]",
"self",
".",
"_bgnames",
"=",
"[",
"]",
"self",
".",
"_odr_models",
"=",
"[",
"]",
"f",... | Uses internal settings to update the functions. | [
"Uses",
"internal",
"settings",
"to",
"update",
"the",
"functions",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1776-L1839 | train |
Spinmob/spinmob | _data.py | fitter.set_data | def set_data(self, xdata=[1,2,3,4,5], ydata=[1.7,2,3,4,3], eydata=None, **kwargs):
"""
This will handle the different types of supplied data and put everything
in a standard format for processing.
Parameters
----------
xdata, ydata
These can be a single a... | python | def set_data(self, xdata=[1,2,3,4,5], ydata=[1.7,2,3,4,3], eydata=None, **kwargs):
"""
This will handle the different types of supplied data and put everything
in a standard format for processing.
Parameters
----------
xdata, ydata
These can be a single a... | [
"def",
"set_data",
"(",
"self",
",",
"xdata",
"=",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
"]",
",",
"ydata",
"=",
"[",
"1.7",
",",
"2",
",",
"3",
",",
"4",
",",
"3",
"]",
",",
"eydata",
"=",
"None",
",",
"**",
"kwargs",
")",
... | This will handle the different types of supplied data and put everything
in a standard format for processing.
Parameters
----------
xdata, ydata
These can be a single array of data or a list of data arrays.
eydata=None
Error bars for ydata. Thes... | [
"This",
"will",
"handle",
"the",
"different",
"types",
"of",
"supplied",
"data",
"and",
"put",
"everything",
"in",
"a",
"standard",
"format",
"for",
"processing",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L1842-L1961 | train |
Spinmob/spinmob | _data.py | fitter.set_guess_to_fit_result | def set_guess_to_fit_result(self):
"""
If you have a fit result, set the guess parameters to the
fit parameters.
"""
if self.results is None:
print("No fit results to use! Run fit() first.")
return
# loop over the results and set the guess values
... | python | def set_guess_to_fit_result(self):
"""
If you have a fit result, set the guess parameters to the
fit parameters.
"""
if self.results is None:
print("No fit results to use! Run fit() first.")
return
# loop over the results and set the guess values
... | [
"def",
"set_guess_to_fit_result",
"(",
"self",
")",
":",
"if",
"self",
".",
"results",
"is",
"None",
":",
"print",
"(",
"\"No fit results to use! Run fit() first.\"",
")",
"return",
"for",
"n",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"_pguess",
")",
")"... | If you have a fit result, set the guess parameters to the
fit parameters. | [
"If",
"you",
"have",
"a",
"fit",
"result",
"set",
"the",
"guess",
"parameters",
"to",
"the",
"fit",
"parameters",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2080-L2094 | train |
Spinmob/spinmob | _data.py | fitter._massage_data | def _massage_data(self):
"""
Processes the data and stores it.
"""
self._xdata_massaged, self._ydata_massaged, self._eydata_massaged = self.get_processed_data()
# # Create the odr data.
# self._odr_datas = []
# for n in range(len(self._xdata_massaged)):
# ... | python | def _massage_data(self):
"""
Processes the data and stores it.
"""
self._xdata_massaged, self._ydata_massaged, self._eydata_massaged = self.get_processed_data()
# # Create the odr data.
# self._odr_datas = []
# for n in range(len(self._xdata_massaged)):
# ... | [
"def",
"_massage_data",
"(",
"self",
")",
":",
"self",
".",
"_xdata_massaged",
",",
"self",
".",
"_ydata_massaged",
",",
"self",
".",
"_eydata_massaged",
"=",
"self",
".",
"get_processed_data",
"(",
")",
"return",
"self"
] | Processes the data and stores it. | [
"Processes",
"the",
"data",
"and",
"stores",
"it",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2190-L2206 | train |
Spinmob/spinmob | _data.py | fitter.free | def free(self, *args, **kwargs):
"""
Turns a constant into a parameter. As arguments, parameters must be strings.
As keyword arguments, they can be set at the same time.
"""
# first set all the keyword argument values
self.set(**kwargs)
# get everything into one ... | python | def free(self, *args, **kwargs):
"""
Turns a constant into a parameter. As arguments, parameters must be strings.
As keyword arguments, they can be set at the same time.
"""
# first set all the keyword argument values
self.set(**kwargs)
# get everything into one ... | [
"def",
"free",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"set",
"(",
"**",
"kwargs",
")",
"cnames",
"=",
"list",
"(",
"args",
")",
"+",
"list",
"(",
"kwargs",
".",
"keys",
"(",
")",
")",
"for",
"cname",
"in",
... | Turns a constant into a parameter. As arguments, parameters must be strings.
As keyword arguments, they can be set at the same time. | [
"Turns",
"a",
"constant",
"into",
"a",
"parameter",
".",
"As",
"arguments",
"parameters",
"must",
"be",
"strings",
".",
"As",
"keyword",
"arguments",
"they",
"can",
"be",
"set",
"at",
"the",
"same",
"time",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2290-L2321 | train |
Spinmob/spinmob | _data.py | fitter._evaluate_f | def _evaluate_f(self, n, xdata, p=None):
"""
Evaluates a single function n for arbitrary xdata and p tuple.
p=None means use the fit results
"""
# by default, use the fit values, otherwise, use the guess values.
if p is None and self.results is not None: p = self.resul... | python | def _evaluate_f(self, n, xdata, p=None):
"""
Evaluates a single function n for arbitrary xdata and p tuple.
p=None means use the fit results
"""
# by default, use the fit values, otherwise, use the guess values.
if p is None and self.results is not None: p = self.resul... | [
"def",
"_evaluate_f",
"(",
"self",
",",
"n",
",",
"xdata",
",",
"p",
"=",
"None",
")",
":",
"if",
"p",
"is",
"None",
"and",
"self",
".",
"results",
"is",
"not",
"None",
":",
"p",
"=",
"self",
".",
"results",
"[",
"0",
"]",
"elif",
"p",
"is",
... | Evaluates a single function n for arbitrary xdata and p tuple.
p=None means use the fit results | [
"Evaluates",
"a",
"single",
"function",
"n",
"for",
"arbitrary",
"xdata",
"and",
"p",
"tuple",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2345-L2359 | train |
Spinmob/spinmob | _data.py | fitter._evaluate_bg | def _evaluate_bg(self, n, xdata, p=None):
"""
Evaluates a single background function n for arbitrary xdata and p tuple.
p=None means use the fit results
"""
# by default, use the fit values, otherwise, use the guess values.
if p is None and self.results is not None: p ... | python | def _evaluate_bg(self, n, xdata, p=None):
"""
Evaluates a single background function n for arbitrary xdata and p tuple.
p=None means use the fit results
"""
# by default, use the fit values, otherwise, use the guess values.
if p is None and self.results is not None: p ... | [
"def",
"_evaluate_bg",
"(",
"self",
",",
"n",
",",
"xdata",
",",
"p",
"=",
"None",
")",
":",
"if",
"p",
"is",
"None",
"and",
"self",
".",
"results",
"is",
"not",
"None",
":",
"p",
"=",
"self",
".",
"results",
"[",
"0",
"]",
"elif",
"p",
"is",
... | Evaluates a single background function n for arbitrary xdata and p tuple.
p=None means use the fit results | [
"Evaluates",
"a",
"single",
"background",
"function",
"n",
"for",
"arbitrary",
"xdata",
"and",
"p",
"tuple",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2361-L2378 | train |
Spinmob/spinmob | _data.py | fitter.chi_squareds | def chi_squareds(self, p=None):
"""
Returns a list of chi squared for each data set. Also uses ydata_massaged.
p=None means use the fit results
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
if p is None: p = self.results[0]
# ge... | python | def chi_squareds(self, p=None):
"""
Returns a list of chi squared for each data set. Also uses ydata_massaged.
p=None means use the fit results
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
if p is None: p = self.results[0]
# ge... | [
"def",
"chi_squareds",
"(",
"self",
",",
"p",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"_set_xdata",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"_set_ydata",
")",
"==",
"0",
":",
"return",
"None",
"if",
"p",
"is",
"None",
":",
... | Returns a list of chi squared for each data set. Also uses ydata_massaged.
p=None means use the fit results | [
"Returns",
"a",
"list",
"of",
"chi",
"squared",
"for",
"each",
"data",
"set",
".",
"Also",
"uses",
"ydata_massaged",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2449-L2468 | train |
Spinmob/spinmob | _data.py | fitter.degrees_of_freedom | def degrees_of_freedom(self):
"""
Returns the number of degrees of freedom.
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
# Temporary hack: get the studentized residuals, which uses the massaged data
# This should later be changed to get_... | python | def degrees_of_freedom(self):
"""
Returns the number of degrees of freedom.
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
# Temporary hack: get the studentized residuals, which uses the massaged data
# This should later be changed to get_... | [
"def",
"degrees_of_freedom",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_set_xdata",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"_set_ydata",
")",
"==",
"0",
":",
"return",
"None",
"r",
"=",
"self",
".",
"studentized_residuals",
"(",
... | Returns the number of degrees of freedom. | [
"Returns",
"the",
"number",
"of",
"degrees",
"of",
"freedom",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2481-L2498 | train |
Spinmob/spinmob | _data.py | fitter.reduced_chi_squareds | def reduced_chi_squareds(self, p=None):
"""
Returns the reduced chi squared for each massaged data set.
p=None means use the fit results.
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
if p is None: p = self.results[0]
r = self.studentiz... | python | def reduced_chi_squareds(self, p=None):
"""
Returns the reduced chi squared for each massaged data set.
p=None means use the fit results.
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
if p is None: p = self.results[0]
r = self.studentiz... | [
"def",
"reduced_chi_squareds",
"(",
"self",
",",
"p",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"_set_xdata",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"_set_ydata",
")",
"==",
"0",
":",
"return",
"None",
"if",
"p",
"is",
"None",
... | Returns the reduced chi squared for each massaged data set.
p=None means use the fit results. | [
"Returns",
"the",
"reduced",
"chi",
"squared",
"for",
"each",
"massaged",
"data",
"set",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2502-L2526 | train |
Spinmob/spinmob | _data.py | fitter.reduced_chi_squared | def reduced_chi_squared(self, p=None):
"""
Returns the reduced chi squared for all massaged data sets.
p=None means use the fit results.
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
if p is None: p = self.results[0]
ch... | python | def reduced_chi_squared(self, p=None):
"""
Returns the reduced chi squared for all massaged data sets.
p=None means use the fit results.
"""
if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
if p is None: p = self.results[0]
ch... | [
"def",
"reduced_chi_squared",
"(",
"self",
",",
"p",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"_set_xdata",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"_set_ydata",
")",
"==",
"0",
":",
"return",
"None",
"if",
"p",
"is",
"None",
... | Returns the reduced chi squared for all massaged data sets.
p=None means use the fit results. | [
"Returns",
"the",
"reduced",
"chi",
"squared",
"for",
"all",
"massaged",
"data",
"sets",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2528-L2543 | train |
Spinmob/spinmob | _data.py | fitter.autoscale_eydata | def autoscale_eydata(self):
"""
Rescales the error so the next fit will give reduced chi squareds of 1.
Each data set will be scaled independently, and you may wish to run
this a few times until it converges.
"""
if not self.results:
self._error("You must com... | python | def autoscale_eydata(self):
"""
Rescales the error so the next fit will give reduced chi squareds of 1.
Each data set will be scaled independently, and you may wish to run
this a few times until it converges.
"""
if not self.results:
self._error("You must com... | [
"def",
"autoscale_eydata",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"results",
":",
"self",
".",
"_error",
"(",
"\"You must complete a fit first.\"",
")",
"return",
"r",
"=",
"self",
".",
"reduced_chi_squareds",
"(",
")",
"for",
"n",
"in",
"range",
... | Rescales the error so the next fit will give reduced chi squareds of 1.
Each data set will be scaled independently, and you may wish to run
this a few times until it converges. | [
"Rescales",
"the",
"error",
"so",
"the",
"next",
"fit",
"will",
"give",
"reduced",
"chi",
"squareds",
"of",
"1",
".",
"Each",
"data",
"set",
"will",
"be",
"scaled",
"independently",
"and",
"you",
"may",
"wish",
"to",
"run",
"this",
"a",
"few",
"times",
... | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2545-L2566 | train |
Spinmob/spinmob | _data.py | fitter.trim | def trim(self, n='all', x=True, y=True):
"""
This will set xmin and xmax based on the current zoom-level of the
figures.
n='all' Which figure to use for setting xmin and xmax.
'all' means all figures. You may also specify a list.
x=True Trim the x-ra... | python | def trim(self, n='all', x=True, y=True):
"""
This will set xmin and xmax based on the current zoom-level of the
figures.
n='all' Which figure to use for setting xmin and xmax.
'all' means all figures. You may also specify a list.
x=True Trim the x-ra... | [
"def",
"trim",
"(",
"self",
",",
"n",
"=",
"'all'",
",",
"x",
"=",
"True",
",",
"y",
"=",
"True",
")",
":",
"if",
"len",
"(",
"self",
".",
"_set_xdata",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"_set_ydata",
")",
"==",
"0",
":",
"self",... | This will set xmin and xmax based on the current zoom-level of the
figures.
n='all' Which figure to use for setting xmin and xmax.
'all' means all figures. You may also specify a list.
x=True Trim the x-range
y=True Trim the y-range | [
"This",
"will",
"set",
"xmin",
"and",
"xmax",
"based",
"on",
"the",
"current",
"zoom",
"-",
"level",
"of",
"the",
"figures",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2872-L2909 | train |
Spinmob/spinmob | _data.py | fitter.zoom | def zoom(self, n='all', xfactor=2.0, yfactor=2.0):
"""
This will scale the chosen data set's plot range by the
specified xfactor and yfactor, respectively, and set the trim limits
xmin, xmax, ymin, ymax accordingly
Parameters
----------
n='all'
W... | python | def zoom(self, n='all', xfactor=2.0, yfactor=2.0):
"""
This will scale the chosen data set's plot range by the
specified xfactor and yfactor, respectively, and set the trim limits
xmin, xmax, ymin, ymax accordingly
Parameters
----------
n='all'
W... | [
"def",
"zoom",
"(",
"self",
",",
"n",
"=",
"'all'",
",",
"xfactor",
"=",
"2.0",
",",
"yfactor",
"=",
"2.0",
")",
":",
"if",
"len",
"(",
"self",
".",
"_set_xdata",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"_set_ydata",
")",
"==",
"0",
":",... | This will scale the chosen data set's plot range by the
specified xfactor and yfactor, respectively, and set the trim limits
xmin, xmax, ymin, ymax accordingly
Parameters
----------
n='all'
Which data set to perform this action upon. 'all' means all data
... | [
"This",
"will",
"scale",
"the",
"chosen",
"data",
"set",
"s",
"plot",
"range",
"by",
"the",
"specified",
"xfactor",
"and",
"yfactor",
"respectively",
"and",
"set",
"the",
"trim",
"limits",
"xmin",
"xmax",
"ymin",
"ymax",
"accordingly"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2940-L2988 | train |
Spinmob/spinmob | _data.py | fitter.ginput | def ginput(self, data_set=0, **kwargs):
"""
Pops up the figure for the specified data set.
Returns value from pylab.ginput().
kwargs are sent to pylab.ginput()
"""
# this will temporarily fix the deprecation warning
import warnings
import matplotlib.cboo... | python | def ginput(self, data_set=0, **kwargs):
"""
Pops up the figure for the specified data set.
Returns value from pylab.ginput().
kwargs are sent to pylab.ginput()
"""
# this will temporarily fix the deprecation warning
import warnings
import matplotlib.cboo... | [
"def",
"ginput",
"(",
"self",
",",
"data_set",
"=",
"0",
",",
"**",
"kwargs",
")",
":",
"import",
"warnings",
"import",
"matplotlib",
".",
"cbook",
"warnings",
".",
"filterwarnings",
"(",
"\"ignore\"",
",",
"category",
"=",
"matplotlib",
".",
"cbook",
".",... | Pops up the figure for the specified data set.
Returns value from pylab.ginput().
kwargs are sent to pylab.ginput() | [
"Pops",
"up",
"the",
"figure",
"for",
"the",
"specified",
"data",
"set",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2991-L3005 | train |
Spinmob/spinmob | _plotting_mess.py | _match_data_sets | def _match_data_sets(x,y):
"""
Makes sure everything is the same shape. "Intelligently".
"""
# Handle the None for x or y
if x is None:
# If x is none, y can be either [1,2] or [[1,2],[1,2]]
if _fun.is_iterable(y[0]):
# make an array of arrays to match
x = []... | python | def _match_data_sets(x,y):
"""
Makes sure everything is the same shape. "Intelligently".
"""
# Handle the None for x or y
if x is None:
# If x is none, y can be either [1,2] or [[1,2],[1,2]]
if _fun.is_iterable(y[0]):
# make an array of arrays to match
x = []... | [
"def",
"_match_data_sets",
"(",
"x",
",",
"y",
")",
":",
"if",
"x",
"is",
"None",
":",
"if",
"_fun",
".",
"is_iterable",
"(",
"y",
"[",
"0",
"]",
")",
":",
"x",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"len",
"(",
"y",
")",
")",
":",
... | Makes sure everything is the same shape. "Intelligently". | [
"Makes",
"sure",
"everything",
"is",
"the",
"same",
"shape",
".",
"Intelligently",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L26-L64 | train |
Spinmob/spinmob | _plotting_mess.py | _match_error_to_data_set | def _match_error_to_data_set(x, ex):
"""
Inflates ex to match the dimensionality of x, "intelligently".
x is assumed to be a 2D array.
"""
# Simplest case, ex is None or a number
if not _fun.is_iterable(ex):
# Just make a matched list of Nones
if ex is None: ex = [ex]*l... | python | def _match_error_to_data_set(x, ex):
"""
Inflates ex to match the dimensionality of x, "intelligently".
x is assumed to be a 2D array.
"""
# Simplest case, ex is None or a number
if not _fun.is_iterable(ex):
# Just make a matched list of Nones
if ex is None: ex = [ex]*l... | [
"def",
"_match_error_to_data_set",
"(",
"x",
",",
"ex",
")",
":",
"if",
"not",
"_fun",
".",
"is_iterable",
"(",
"ex",
")",
":",
"if",
"ex",
"is",
"None",
":",
"ex",
"=",
"[",
"ex",
"]",
"*",
"len",
"(",
"x",
")",
"if",
"_fun",
".",
"is_a_number",... | Inflates ex to match the dimensionality of x, "intelligently".
x is assumed to be a 2D array. | [
"Inflates",
"ex",
"to",
"match",
"the",
"dimensionality",
"of",
"x",
"intelligently",
".",
"x",
"is",
"assumed",
"to",
"be",
"a",
"2D",
"array",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L66-L98 | train |
Spinmob/spinmob | _plotting_mess.py | complex_data | def complex_data(data, edata=None, draw=True, **kwargs):
"""
Plots the imaginary vs real for complex data.
Parameters
----------
data
Array of complex data
edata=None
Array of complex error bars
draw=True
Draw the plot after it's assembled?
Se... | python | def complex_data(data, edata=None, draw=True, **kwargs):
"""
Plots the imaginary vs real for complex data.
Parameters
----------
data
Array of complex data
edata=None
Array of complex error bars
draw=True
Draw the plot after it's assembled?
Se... | [
"def",
"complex_data",
"(",
"data",
",",
"edata",
"=",
"None",
",",
"draw",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"_pylab",
".",
"ioff",
"(",
")",
"try",
":",
"rdata",
"=",
"_n",
".",
"real",
"(",
"data",
")",
"idata",
"=",
"_n",
".",
"im... | Plots the imaginary vs real for complex data.
Parameters
----------
data
Array of complex data
edata=None
Array of complex error bars
draw=True
Draw the plot after it's assembled?
See spinmob.plot.xy.data() for additional optional keyword arguments. | [
"Plots",
"the",
"imaginary",
"vs",
"real",
"for",
"complex",
"data",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L103-L157 | train |
Spinmob/spinmob | _plotting_mess.py | complex_files | def complex_files(script='d[1]+1j*d[2]', escript=None, paths=None, **kwargs):
"""
Loads files and plots complex data in the real-imaginary plane.
Parameters
----------
script='d[1]+1j*d[2]'
Complex-valued script for data array.
escript=None
Complex-valued script fo... | python | def complex_files(script='d[1]+1j*d[2]', escript=None, paths=None, **kwargs):
"""
Loads files and plots complex data in the real-imaginary plane.
Parameters
----------
script='d[1]+1j*d[2]'
Complex-valued script for data array.
escript=None
Complex-valued script fo... | [
"def",
"complex_files",
"(",
"script",
"=",
"'d[1]+1j*d[2]'",
",",
"escript",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"ds",
"=",
"_data",
".",
"load_multiple",
"(",
"paths",
"=",
"paths",
")",
"if",
"len",
"(",
"ds",
")... | Loads files and plots complex data in the real-imaginary plane.
Parameters
----------
script='d[1]+1j*d[2]'
Complex-valued script for data array.
escript=None
Complex-valued script for error bars
paths=None
List of paths to open. None means use a dialog
Se... | [
"Loads",
"files",
"and",
"plots",
"complex",
"data",
"in",
"the",
"real",
"-",
"imaginary",
"plane",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L202-L230 | train |
Spinmob/spinmob | _plotting_mess.py | magphase_databoxes | def magphase_databoxes(ds, xscript=0, yscript='d[1]+1j*d[2]', eyscript=None, exscript=None, g=None, **kwargs):
"""
Use databoxes and scripts to generate data and plot the complex magnitude
and phase versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
... | python | def magphase_databoxes(ds, xscript=0, yscript='d[1]+1j*d[2]', eyscript=None, exscript=None, g=None, **kwargs):
"""
Use databoxes and scripts to generate data and plot the complex magnitude
and phase versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
... | [
"def",
"magphase_databoxes",
"(",
"ds",
",",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"'d[1]+1j*d[2]'",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"databoxes",
"(",
"ds",
",",
"x... | Use databoxes and scripts to generate data and plot the complex magnitude
and phase versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Script for x data
yscript='d[1]+1j*d[2]'
Script for y data
eyscript=None
Script for y error
... | [
"Use",
"databoxes",
"and",
"scripts",
"to",
"generate",
"data",
"and",
"plot",
"the",
"complex",
"magnitude",
"and",
"phase",
"versus",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L358-L381 | train |
Spinmob/spinmob | _plotting_mess.py | magphase_files | def magphase_files(xscript=0, yscript='d[1]+1j*d[2]', eyscript=None, exscript=None, paths=None, g=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata's magnitude and phase versus xdata.
Parameters
----------
xscript=0
... | python | def magphase_files(xscript=0, yscript='d[1]+1j*d[2]', eyscript=None, exscript=None, paths=None, g=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata's magnitude and phase versus xdata.
Parameters
----------
xscript=0
... | [
"def",
"magphase_files",
"(",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"'d[1]+1j*d[2]'",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"return",
"files",
... | This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata's magnitude and phase versus xdata.
Parameters
----------
xscript=0
Script for x data
yscript='d[1]+1j*d[2]'
Script for y data
eyscript=None
Script for y error... | [
"This",
"will",
"load",
"a",
"bunch",
"of",
"data",
"files",
"generate",
"data",
"based",
"on",
"the",
"supplied",
"scripts",
"and",
"then",
"plot",
"the",
"ydata",
"s",
"magnitude",
"and",
"phase",
"versus",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L383-L412 | train |
Spinmob/spinmob | _plotting_mess.py | realimag_data | def realimag_data(xdata, ydata, eydata=None, exdata=None, xscale='linear', rscale='linear', iscale='linear', rlabel='Real', ilabel='Imaginary', figure='gcf', clear=1, draw=True, **kwargs):
"""
Plots the real and imaginary parts of complex ydata vs xdata.
Parameters
----------
xdata
Real-val... | python | def realimag_data(xdata, ydata, eydata=None, exdata=None, xscale='linear', rscale='linear', iscale='linear', rlabel='Real', ilabel='Imaginary', figure='gcf', clear=1, draw=True, **kwargs):
"""
Plots the real and imaginary parts of complex ydata vs xdata.
Parameters
----------
xdata
Real-val... | [
"def",
"realimag_data",
"(",
"xdata",
",",
"ydata",
",",
"eydata",
"=",
"None",
",",
"exdata",
"=",
"None",
",",
"xscale",
"=",
"'linear'",
",",
"rscale",
"=",
"'linear'",
",",
"iscale",
"=",
"'linear'",
",",
"rlabel",
"=",
"'Real'",
",",
"ilabel",
"="... | Plots the real and imaginary parts of complex ydata vs xdata.
Parameters
----------
xdata
Real-valued x-axis data
ydata
Complex-valued y-axis data
eydata=None
Complex-valued y-error
exdata=None
Real-valued x-error
xscale='line... | [
"Plots",
"the",
"real",
"and",
"imaginary",
"parts",
"of",
"complex",
"ydata",
"vs",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L441-L524 | train |
Spinmob/spinmob | _plotting_mess.py | realimag_databoxes | def realimag_databoxes(ds, xscript=0, yscript="d[1]+1j*d[2]", eyscript=None, exscript=None, g=None, **kwargs):
"""
Use databoxes and scripts to generate data and plot the real and
imaginary ydata versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Sc... | python | def realimag_databoxes(ds, xscript=0, yscript="d[1]+1j*d[2]", eyscript=None, exscript=None, g=None, **kwargs):
"""
Use databoxes and scripts to generate data and plot the real and
imaginary ydata versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Sc... | [
"def",
"realimag_databoxes",
"(",
"ds",
",",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"\"d[1]+1j*d[2]\"",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"databoxes",
"(",
"ds",
",",
... | Use databoxes and scripts to generate data and plot the real and
imaginary ydata versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Script for x data
yscript='d[1]+1j*d[2]'
Script for y data
eyscript=None
Script for y error
e... | [
"Use",
"databoxes",
"and",
"scripts",
"to",
"generate",
"data",
"and",
"plot",
"the",
"real",
"and",
"imaginary",
"ydata",
"versus",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L527-L550 | train |
Spinmob/spinmob | _plotting_mess.py | realimag_files | def realimag_files(xscript=0, yscript="d[1]+1j*d[2]", eyscript=None, exscript=None, paths=None, g=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata's real and imaginary parts versus xdata.
Parameters
----------
xscrip... | python | def realimag_files(xscript=0, yscript="d[1]+1j*d[2]", eyscript=None, exscript=None, paths=None, g=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata's real and imaginary parts versus xdata.
Parameters
----------
xscrip... | [
"def",
"realimag_files",
"(",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"\"d[1]+1j*d[2]\"",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"return",
"files",
... | This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata's real and imaginary parts versus xdata.
Parameters
----------
xscript=0
Script for x data
yscript='d[1]+1j*d[2]'
Script for y data
eyscript=None
Script for y ... | [
"This",
"will",
"load",
"a",
"bunch",
"of",
"data",
"files",
"generate",
"data",
"based",
"on",
"the",
"supplied",
"scripts",
"and",
"then",
"plot",
"the",
"ydata",
"s",
"real",
"and",
"imaginary",
"parts",
"versus",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L552-L580 | train |
Spinmob/spinmob | _plotting_mess.py | xy_databoxes | def xy_databoxes(ds, xscript=0, yscript='d[1]', eyscript=None, exscript=None, g=None, **kwargs):
"""
Use databoxes and scripts to generate and plot ydata versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Script for x data
yscript='d[1]'
Scr... | python | def xy_databoxes(ds, xscript=0, yscript='d[1]', eyscript=None, exscript=None, g=None, **kwargs):
"""
Use databoxes and scripts to generate and plot ydata versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Script for x data
yscript='d[1]'
Scr... | [
"def",
"xy_databoxes",
"(",
"ds",
",",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"'d[1]'",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"databoxes",
"(",
"ds",
",",
"xscript",
","... | Use databoxes and scripts to generate and plot ydata versus xdata.
Parameters
----------
ds
List of databoxes
xscript=0
Script for x data
yscript='d[1]'
Script for y data
eyscript=None
Script for y error
exscript=None
Script for x error
... | [
"Use",
"databoxes",
"and",
"scripts",
"to",
"generate",
"and",
"plot",
"ydata",
"versus",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L748-L771 | train |
Spinmob/spinmob | _plotting_mess.py | xy_files | def xy_files(xscript=0, yscript='d[1]', eyscript=None, exscript=None, paths=None, g=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata versus xdata.
Parameters
----------
xscript=0
Script for x data
yscrip... | python | def xy_files(xscript=0, yscript='d[1]', eyscript=None, exscript=None, paths=None, g=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata versus xdata.
Parameters
----------
xscript=0
Script for x data
yscrip... | [
"def",
"xy_files",
"(",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"'d[1]'",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"return",
"files",
"(",
"xscrip... | This will load a bunch of data files, generate data based on the supplied
scripts, and then plot the ydata versus xdata.
Parameters
----------
xscript=0
Script for x data
yscript='d[1]'
Script for y data
eyscript=None
Script for y error
exscript=None
Scr... | [
"This",
"will",
"load",
"a",
"bunch",
"of",
"data",
"files",
"generate",
"data",
"based",
"on",
"the",
"supplied",
"scripts",
"and",
"then",
"plot",
"the",
"ydata",
"versus",
"xdata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L774-L803 | train |
Spinmob/spinmob | _plotting_mess.py | files | def files(xscript=0, yscript=1, eyscript=None, exscript=None, g=None, plotter=xy_databoxes, paths=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot this data using the specified databox plotter.
xscript, yscript, eyscript, exscript ... | python | def files(xscript=0, yscript=1, eyscript=None, exscript=None, g=None, plotter=xy_databoxes, paths=None, **kwargs):
"""
This will load a bunch of data files, generate data based on the supplied
scripts, and then plot this data using the specified databox plotter.
xscript, yscript, eyscript, exscript ... | [
"def",
"files",
"(",
"xscript",
"=",
"0",
",",
"yscript",
"=",
"1",
",",
"eyscript",
"=",
"None",
",",
"exscript",
"=",
"None",
",",
"g",
"=",
"None",
",",
"plotter",
"=",
"xy_databoxes",
",",
"paths",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
... | This will load a bunch of data files, generate data based on the supplied
scripts, and then plot this data using the specified databox plotter.
xscript, yscript, eyscript, exscript scripts to generate x, y, and errors
g optional dictionary of globals
optional: ... | [
"This",
"will",
"load",
"a",
"bunch",
"of",
"data",
"files",
"generate",
"data",
"based",
"on",
"the",
"supplied",
"scripts",
"and",
"then",
"plot",
"this",
"data",
"using",
"the",
"specified",
"databox",
"plotter",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L929-L956 | train |
Spinmob/spinmob | _plotting_mess.py | image_function | def image_function(f='sin(5*x)*cos(5*y)', xmin=-1, xmax=1, ymin=-1, ymax=1, xsteps=100, ysteps=100, p='x,y', g=None, **kwargs):
"""
Plots a 2-d function over the specified range
Parameters
----------
f='sin(5*x)*cos(5*y)'
Takes two inputs and returns one value. Can also
... | python | def image_function(f='sin(5*x)*cos(5*y)', xmin=-1, xmax=1, ymin=-1, ymax=1, xsteps=100, ysteps=100, p='x,y', g=None, **kwargs):
"""
Plots a 2-d function over the specified range
Parameters
----------
f='sin(5*x)*cos(5*y)'
Takes two inputs and returns one value. Can also
... | [
"def",
"image_function",
"(",
"f",
"=",
"'sin(5*x)*cos(5*y)'",
",",
"xmin",
"=",
"-",
"1",
",",
"xmax",
"=",
"1",
",",
"ymin",
"=",
"-",
"1",
",",
"ymax",
"=",
"1",
",",
"xsteps",
"=",
"100",
",",
"ysteps",
"=",
"100",
",",
"p",
"=",
"'x,y'",
"... | Plots a 2-d function over the specified range
Parameters
----------
f='sin(5*x)*cos(5*y)'
Takes two inputs and returns one value. Can also
be a string function such as sin(x*y)
xmin=-1, xmax=1, ymin=-1, ymax=1
Range over which to generate/plot the data
... | [
"Plots",
"a",
"2",
"-",
"d",
"function",
"over",
"the",
"specified",
"range"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L1106-L1164 | train |
Spinmob/spinmob | _plotting_mess.py | image_file | def image_file(path=None, zscript='self[1:]', xscript='[0,1]', yscript='d[0]', g=None, **kwargs):
"""
Loads an data file and plots it with color. Data file must have columns of the
same length!
Parameters
----------
path=None
Path to data file.
zscript='self[1:]'
Determines... | python | def image_file(path=None, zscript='self[1:]', xscript='[0,1]', yscript='d[0]', g=None, **kwargs):
"""
Loads an data file and plots it with color. Data file must have columns of the
same length!
Parameters
----------
path=None
Path to data file.
zscript='self[1:]'
Determines... | [
"def",
"image_file",
"(",
"path",
"=",
"None",
",",
"zscript",
"=",
"'self[1:]'",
",",
"xscript",
"=",
"'[0,1]'",
",",
"yscript",
"=",
"'d[0]'",
",",
"g",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"'delimiter'",
"in",
"kwargs",
":",
"delimiter"... | Loads an data file and plots it with color. Data file must have columns of the
same length!
Parameters
----------
path=None
Path to data file.
zscript='self[1:]'
Determines how to get data from the columns
xscript='[0,1]', yscript='d[0]'
Determine the x and y arrays us... | [
"Loads",
"an",
"data",
"file",
"and",
"plots",
"it",
"with",
"color",
".",
"Data",
"file",
"must",
"have",
"columns",
"of",
"the",
"same",
"length!"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L1167-L1207 | train |
Spinmob/spinmob | _plotting_mess.py | parametric_function | def parametric_function(fx='sin(t)', fy='cos(t)', tmin=-1, tmax=1, steps=200, p='t', g=None, erange=False, **kwargs):
"""
Plots the parametric function over the specified range
Parameters
----------
fx='sin(t)', fy='cos(t)'
Functions or (matching) lists of functions to plot;
... | python | def parametric_function(fx='sin(t)', fy='cos(t)', tmin=-1, tmax=1, steps=200, p='t', g=None, erange=False, **kwargs):
"""
Plots the parametric function over the specified range
Parameters
----------
fx='sin(t)', fy='cos(t)'
Functions or (matching) lists of functions to plot;
... | [
"def",
"parametric_function",
"(",
"fx",
"=",
"'sin(t)'",
",",
"fy",
"=",
"'cos(t)'",
",",
"tmin",
"=",
"-",
"1",
",",
"tmax",
"=",
"1",
",",
"steps",
"=",
"200",
",",
"p",
"=",
"'t'",
",",
"g",
"=",
"None",
",",
"erange",
"=",
"False",
",",
"*... | Plots the parametric function over the specified range
Parameters
----------
fx='sin(t)', fy='cos(t)'
Functions or (matching) lists of functions to plot;
can be string functions or python functions taking one argument
tmin=-1, tmax=1, steps=200
Range over which... | [
"Plots",
"the",
"parametric",
"function",
"over",
"the",
"specified",
"range"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L1213-L1279 | train |
Spinmob/spinmob | _plotting_mess.py | plot_style_cycle.reset | def reset(self):
"""
Resets the style cycle.
"""
for key in list(self.keys()): self.iterators[key] = _itertools.cycle(self[key])
return self | python | def reset(self):
"""
Resets the style cycle.
"""
for key in list(self.keys()): self.iterators[key] = _itertools.cycle(self[key])
return self | [
"def",
"reset",
"(",
"self",
")",
":",
"for",
"key",
"in",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
":",
"self",
".",
"iterators",
"[",
"key",
"]",
"=",
"_itertools",
".",
"cycle",
"(",
"self",
"[",
"key",
"]",
")",
"return",
"self"
] | Resets the style cycle. | [
"Resets",
"the",
"style",
"cycle",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L1320-L1325 | train |
Spinmob/spinmob | _pylab_tweaks.py | add_text | def add_text(text, x=0.01, y=0.01, axes="gca", draw=True, **kwargs):
"""
Adds text to the axes at the specified position.
**kwargs go to the axes.text() function.
"""
if axes=="gca": axes = _pylab.gca()
axes.text(x, y, text, transform=axes.transAxes, **kwargs)
if draw: _pylab.draw() | python | def add_text(text, x=0.01, y=0.01, axes="gca", draw=True, **kwargs):
"""
Adds text to the axes at the specified position.
**kwargs go to the axes.text() function.
"""
if axes=="gca": axes = _pylab.gca()
axes.text(x, y, text, transform=axes.transAxes, **kwargs)
if draw: _pylab.draw() | [
"def",
"add_text",
"(",
"text",
",",
"x",
"=",
"0.01",
",",
"y",
"=",
"0.01",
",",
"axes",
"=",
"\"gca\"",
",",
"draw",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",... | Adds text to the axes at the specified position.
**kwargs go to the axes.text() function. | [
"Adds",
"text",
"to",
"the",
"axes",
"at",
"the",
"specified",
"position",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L36-L44 | train |
Spinmob/spinmob | _pylab_tweaks.py | auto_zoom | def auto_zoom(zoomx=True, zoomy=True, axes="gca", x_space=0.04, y_space=0.04, draw=True):
"""
Looks at the bounds of the plotted data and zooms accordingly, leaving some
space around the data.
"""
# Disable auto-updating by default.
_pylab.ioff()
if axes=="gca": axes = _pylab.gca()
# ... | python | def auto_zoom(zoomx=True, zoomy=True, axes="gca", x_space=0.04, y_space=0.04, draw=True):
"""
Looks at the bounds of the plotted data and zooms accordingly, leaving some
space around the data.
"""
# Disable auto-updating by default.
_pylab.ioff()
if axes=="gca": axes = _pylab.gca()
# ... | [
"def",
"auto_zoom",
"(",
"zoomx",
"=",
"True",
",",
"zoomy",
"=",
"True",
",",
"axes",
"=",
"\"gca\"",
",",
"x_space",
"=",
"0.04",
",",
"y_space",
"=",
"0.04",
",",
"draw",
"=",
"True",
")",
":",
"_pylab",
".",
"ioff",
"(",
")",
"if",
"axes",
"=... | Looks at the bounds of the plotted data and zooms accordingly, leaving some
space around the data. | [
"Looks",
"at",
"the",
"bounds",
"of",
"the",
"plotted",
"data",
"and",
"zooms",
"accordingly",
"leaving",
"some",
"space",
"around",
"the",
"data",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L46-L83 | train |
Spinmob/spinmob | _pylab_tweaks.py | click_estimate_slope | def click_estimate_slope():
"""
Takes two clicks and returns the slope.
Right-click aborts.
"""
c1 = _pylab.ginput()
if len(c1)==0:
return None
c2 = _pylab.ginput()
if len(c2)==0:
return None
return (c1[0][1]-c2[0][1])/(c1[0][0]-c2[0][0]) | python | def click_estimate_slope():
"""
Takes two clicks and returns the slope.
Right-click aborts.
"""
c1 = _pylab.ginput()
if len(c1)==0:
return None
c2 = _pylab.ginput()
if len(c2)==0:
return None
return (c1[0][1]-c2[0][1])/(c1[0][0]-c2[0][0]) | [
"def",
"click_estimate_slope",
"(",
")",
":",
"c1",
"=",
"_pylab",
".",
"ginput",
"(",
")",
"if",
"len",
"(",
"c1",
")",
"==",
"0",
":",
"return",
"None",
"c2",
"=",
"_pylab",
".",
"ginput",
"(",
")",
"if",
"len",
"(",
"c2",
")",
"==",
"0",
":"... | Takes two clicks and returns the slope.
Right-click aborts. | [
"Takes",
"two",
"clicks",
"and",
"returns",
"the",
"slope",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L133-L148 | train |
Spinmob/spinmob | _pylab_tweaks.py | click_estimate_curvature | def click_estimate_curvature():
"""
Takes two clicks and returns the curvature, assuming the first click
was the minimum of a parabola and the second was some other point.
Returns the second derivative of the function giving this parabola.
Right-click aborts.
"""
c1 = _pylab.ginput()
... | python | def click_estimate_curvature():
"""
Takes two clicks and returns the curvature, assuming the first click
was the minimum of a parabola and the second was some other point.
Returns the second derivative of the function giving this parabola.
Right-click aborts.
"""
c1 = _pylab.ginput()
... | [
"def",
"click_estimate_curvature",
"(",
")",
":",
"c1",
"=",
"_pylab",
".",
"ginput",
"(",
")",
"if",
"len",
"(",
"c1",
")",
"==",
"0",
":",
"return",
"None",
"c2",
"=",
"_pylab",
".",
"ginput",
"(",
")",
"if",
"len",
"(",
"c2",
")",
"==",
"0",
... | Takes two clicks and returns the curvature, assuming the first click
was the minimum of a parabola and the second was some other point.
Returns the second derivative of the function giving this parabola.
Right-click aborts. | [
"Takes",
"two",
"clicks",
"and",
"returns",
"the",
"curvature",
"assuming",
"the",
"first",
"click",
"was",
"the",
"minimum",
"of",
"a",
"parabola",
"and",
"the",
"second",
"was",
"some",
"other",
"point",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L150-L168 | train |
Spinmob/spinmob | _pylab_tweaks.py | copy_figure_to_clipboard | def copy_figure_to_clipboard(figure='gcf'):
"""
Copies the specified figure to the system clipboard. Specifying 'gcf'
will use the current figure.
"""
try:
import pyqtgraph as _p
# Get the current figure if necessary
if figure is 'gcf': figure = _s.pylab.gcf(... | python | def copy_figure_to_clipboard(figure='gcf'):
"""
Copies the specified figure to the system clipboard. Specifying 'gcf'
will use the current figure.
"""
try:
import pyqtgraph as _p
# Get the current figure if necessary
if figure is 'gcf': figure = _s.pylab.gcf(... | [
"def",
"copy_figure_to_clipboard",
"(",
"figure",
"=",
"'gcf'",
")",
":",
"try",
":",
"import",
"pyqtgraph",
"as",
"_p",
"if",
"figure",
"is",
"'gcf'",
":",
"figure",
"=",
"_s",
".",
"pylab",
".",
"gcf",
"(",
")",
"path",
"=",
"_os",
".",
"path",
"."... | Copies the specified figure to the system clipboard. Specifying 'gcf'
will use the current figure. | [
"Copies",
"the",
"specified",
"figure",
"to",
"the",
"system",
"clipboard",
".",
"Specifying",
"gcf",
"will",
"use",
"the",
"current",
"figure",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L188-L208 | train |
Spinmob/spinmob | _pylab_tweaks.py | get_figure_window_geometry | def get_figure_window_geometry(fig='gcf'):
"""
This will currently only work for Qt4Agg and WXAgg backends.
Returns position, size
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object.
"""
if type(fig)==str: fig = _pylab.gcf()
elif _fu... | python | def get_figure_window_geometry(fig='gcf'):
"""
This will currently only work for Qt4Agg and WXAgg backends.
Returns position, size
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object.
"""
if type(fig)==str: fig = _pylab.gcf()
elif _fu... | [
"def",
"get_figure_window_geometry",
"(",
"fig",
"=",
"'gcf'",
")",
":",
"if",
"type",
"(",
"fig",
")",
"==",
"str",
":",
"fig",
"=",
"_pylab",
".",
"gcf",
"(",
")",
"elif",
"_fun",
".",
"is_a_number",
"(",
"fig",
")",
":",
"fig",
"=",
"_pylab",
".... | This will currently only work for Qt4Agg and WXAgg backends.
Returns position, size
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object. | [
"This",
"will",
"currently",
"only",
"work",
"for",
"Qt4Agg",
"and",
"WXAgg",
"backends",
".",
"Returns",
"position",
"size"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L363-L385 | train |
Spinmob/spinmob | _pylab_tweaks.py | impose_legend_limit | def impose_legend_limit(limit=30, axes="gca", **kwargs):
"""
This will erase all but, say, 30 of the legend entries and remake the legend.
You'll probably have to move it back into your favorite position at this point.
"""
if axes=="gca": axes = _pylab.gca()
# make these axes current
_pylab... | python | def impose_legend_limit(limit=30, axes="gca", **kwargs):
"""
This will erase all but, say, 30 of the legend entries and remake the legend.
You'll probably have to move it back into your favorite position at this point.
"""
if axes=="gca": axes = _pylab.gca()
# make these axes current
_pylab... | [
"def",
"impose_legend_limit",
"(",
"limit",
"=",
"30",
",",
"axes",
"=",
"\"gca\"",
",",
"**",
"kwargs",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"_pylab",
".",
"axes",
"(",
"axes",
")",
"for",
"n",... | This will erase all but, say, 30 of the legend entries and remake the legend.
You'll probably have to move it back into your favorite position at this point. | [
"This",
"will",
"erase",
"all",
"but",
"say",
"30",
"of",
"the",
"legend",
"entries",
"and",
"remake",
"the",
"legend",
".",
"You",
"ll",
"probably",
"have",
"to",
"move",
"it",
"back",
"into",
"your",
"favorite",
"position",
"at",
"this",
"point",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L418-L433 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_coarsen | def image_coarsen(xlevel=0, ylevel=0, image="auto", method='average'):
"""
This will coarsen the image data by binning each xlevel+1 along the x-axis
and each ylevel+1 points along the y-axis
type can be 'average', 'min', or 'max'
"""
if image == "auto": image = _pylab.gca().images[0]
Z = ... | python | def image_coarsen(xlevel=0, ylevel=0, image="auto", method='average'):
"""
This will coarsen the image data by binning each xlevel+1 along the x-axis
and each ylevel+1 points along the y-axis
type can be 'average', 'min', or 'max'
"""
if image == "auto": image = _pylab.gca().images[0]
Z = ... | [
"def",
"image_coarsen",
"(",
"xlevel",
"=",
"0",
",",
"ylevel",
"=",
"0",
",",
"image",
"=",
"\"auto\"",
",",
"method",
"=",
"'average'",
")",
":",
"if",
"image",
"==",
"\"auto\"",
":",
"image",
"=",
"_pylab",
".",
"gca",
"(",
")",
".",
"images",
"... | This will coarsen the image data by binning each xlevel+1 along the x-axis
and each ylevel+1 points along the y-axis
type can be 'average', 'min', or 'max' | [
"This",
"will",
"coarsen",
"the",
"image",
"data",
"by",
"binning",
"each",
"xlevel",
"+",
"1",
"along",
"the",
"x",
"-",
"axis",
"and",
"each",
"ylevel",
"+",
"1",
"points",
"along",
"the",
"y",
"-",
"axis"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L449-L469 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_neighbor_smooth | def image_neighbor_smooth(xlevel=0.2, ylevel=0.2, image="auto"):
"""
This will bleed nearest neighbor pixels into each other with
the specified weight factors.
"""
if image == "auto": image = _pylab.gca().images[0]
Z = _n.array(image.get_array())
# store this image in the undo list
glo... | python | def image_neighbor_smooth(xlevel=0.2, ylevel=0.2, image="auto"):
"""
This will bleed nearest neighbor pixels into each other with
the specified weight factors.
"""
if image == "auto": image = _pylab.gca().images[0]
Z = _n.array(image.get_array())
# store this image in the undo list
glo... | [
"def",
"image_neighbor_smooth",
"(",
"xlevel",
"=",
"0.2",
",",
"ylevel",
"=",
"0.2",
",",
"image",
"=",
"\"auto\"",
")",
":",
"if",
"image",
"==",
"\"auto\"",
":",
"image",
"=",
"_pylab",
".",
"gca",
"(",
")",
".",
"images",
"[",
"0",
"]",
"Z",
"=... | This will bleed nearest neighbor pixels into each other with
the specified weight factors. | [
"This",
"will",
"bleed",
"nearest",
"neighbor",
"pixels",
"into",
"each",
"other",
"with",
"the",
"specified",
"weight",
"factors",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L472-L506 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_undo | def image_undo():
"""
Undoes the last coarsen or smooth command.
"""
if len(image_undo_list) <= 0:
print("no undos in memory")
return
[image, Z] = image_undo_list.pop(-1)
image.set_array(Z)
_pylab.draw() | python | def image_undo():
"""
Undoes the last coarsen or smooth command.
"""
if len(image_undo_list) <= 0:
print("no undos in memory")
return
[image, Z] = image_undo_list.pop(-1)
image.set_array(Z)
_pylab.draw() | [
"def",
"image_undo",
"(",
")",
":",
"if",
"len",
"(",
"image_undo_list",
")",
"<=",
"0",
":",
"print",
"(",
"\"no undos in memory\"",
")",
"return",
"[",
"image",
",",
"Z",
"]",
"=",
"image_undo_list",
".",
"pop",
"(",
"-",
"1",
")",
"image",
".",
"s... | Undoes the last coarsen or smooth command. | [
"Undoes",
"the",
"last",
"coarsen",
"or",
"smooth",
"command",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L508-L518 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_set_aspect | def image_set_aspect(aspect=1.0, axes="gca"):
"""
sets the aspect ratio of the current zoom level of the imshow image
"""
if axes is "gca": axes = _pylab.gca()
e = axes.get_images()[0].get_extent()
axes.set_aspect(abs((e[1]-e[0])/(e[3]-e[2]))/aspect) | python | def image_set_aspect(aspect=1.0, axes="gca"):
"""
sets the aspect ratio of the current zoom level of the imshow image
"""
if axes is "gca": axes = _pylab.gca()
e = axes.get_images()[0].get_extent()
axes.set_aspect(abs((e[1]-e[0])/(e[3]-e[2]))/aspect) | [
"def",
"image_set_aspect",
"(",
"aspect",
"=",
"1.0",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"is",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"e",
"=",
"axes",
".",
"get_images",
"(",
")",
"[",
"0",
"]",
".",
"get_... | sets the aspect ratio of the current zoom level of the imshow image | [
"sets",
"the",
"aspect",
"ratio",
"of",
"the",
"current",
"zoom",
"level",
"of",
"the",
"imshow",
"image"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L521-L528 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_set_extent | def image_set_extent(x=None, y=None, axes="gca"):
"""
Set's the first image's extent, then redraws.
Examples:
x = [1,4]
y = [33.3, 22]
"""
if axes == "gca": axes = _pylab.gca()
# get the current plot limits
xlim = axes.get_xlim()
ylim = axes.get_ylim()
# get the old extent... | python | def image_set_extent(x=None, y=None, axes="gca"):
"""
Set's the first image's extent, then redraws.
Examples:
x = [1,4]
y = [33.3, 22]
"""
if axes == "gca": axes = _pylab.gca()
# get the current plot limits
xlim = axes.get_xlim()
ylim = axes.get_ylim()
# get the old extent... | [
"def",
"image_set_extent",
"(",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"xlim",
"=",
"axes",
".",
"get_xlim",
"(",
")",
"ylim... | Set's the first image's extent, then redraws.
Examples:
x = [1,4]
y = [33.3, 22] | [
"Set",
"s",
"the",
"first",
"image",
"s",
"extent",
"then",
"redraws",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L530-L586 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_scale | def image_scale(xscale=1.0, yscale=1.0, axes="gca"):
"""
Scales the image extent.
"""
if axes == "gca": axes = _pylab.gca()
e = axes.images[0].get_extent()
x1 = e[0]*xscale
x2 = e[1]*xscale
y1 = e[2]*yscale
y2 = e[3]*yscale
image_set_extent([x1,x2],[y1,y2], axes) | python | def image_scale(xscale=1.0, yscale=1.0, axes="gca"):
"""
Scales the image extent.
"""
if axes == "gca": axes = _pylab.gca()
e = axes.images[0].get_extent()
x1 = e[0]*xscale
x2 = e[1]*xscale
y1 = e[2]*yscale
y2 = e[3]*yscale
image_set_extent([x1,x2],[y1,y2], axes) | [
"def",
"image_scale",
"(",
"xscale",
"=",
"1.0",
",",
"yscale",
"=",
"1.0",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"e",
"=",
"axes",
".",
"images",
"[",
"0",
"]",
... | Scales the image extent. | [
"Scales",
"the",
"image",
"extent",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L589-L601 | train |
Spinmob/spinmob | _pylab_tweaks.py | image_shift | def image_shift(xshift=0, yshift=0, axes="gca"):
"""
This will shift an image to a new location on x and y.
"""
if axes=="gca": axes = _pylab.gca()
e = axes.images[0].get_extent()
e[0] = e[0] + xshift
e[1] = e[1] + xshift
e[2] = e[2] + yshift
e[3] = e[3] + yshift
axes.images[... | python | def image_shift(xshift=0, yshift=0, axes="gca"):
"""
This will shift an image to a new location on x and y.
"""
if axes=="gca": axes = _pylab.gca()
e = axes.images[0].get_extent()
e[0] = e[0] + xshift
e[1] = e[1] + xshift
e[2] = e[2] + yshift
e[3] = e[3] + yshift
axes.images[... | [
"def",
"image_shift",
"(",
"xshift",
"=",
"0",
",",
"yshift",
"=",
"0",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"e",
"=",
"axes",
".",
"images",
"[",
"0",
"]",
".",... | This will shift an image to a new location on x and y. | [
"This",
"will",
"shift",
"an",
"image",
"to",
"a",
"new",
"location",
"on",
"x",
"and",
"y",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L651-L667 | train |
Spinmob/spinmob | _pylab_tweaks.py | _print_figures | def _print_figures(figures, arguments='', file_format='pdf', target_width=8.5, target_height=11.0, target_pad=0.5):
"""
figure printing loop designed to be launched in a separate thread.
"""
for fig in figures:
# get the temp path
temp_path = _os.path.join(_settings.path_home, "temp")
... | python | def _print_figures(figures, arguments='', file_format='pdf', target_width=8.5, target_height=11.0, target_pad=0.5):
"""
figure printing loop designed to be launched in a separate thread.
"""
for fig in figures:
# get the temp path
temp_path = _os.path.join(_settings.path_home, "temp")
... | [
"def",
"_print_figures",
"(",
"figures",
",",
"arguments",
"=",
"''",
",",
"file_format",
"=",
"'pdf'",
",",
"target_width",
"=",
"8.5",
",",
"target_height",
"=",
"11.0",
",",
"target_pad",
"=",
"0.5",
")",
":",
"for",
"fig",
"in",
"figures",
":",
"temp... | figure printing loop designed to be launched in a separate thread. | [
"figure",
"printing",
"loop",
"designed",
"to",
"be",
"launched",
"in",
"a",
"separate",
"thread",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L882-L935 | train |
Spinmob/spinmob | _pylab_tweaks.py | raise_figure_window | def raise_figure_window(f=0):
"""
Raises the supplied figure number or figure window.
"""
if _fun.is_a_number(f): f = _pylab.figure(f)
f.canvas.manager.window.raise_() | python | def raise_figure_window(f=0):
"""
Raises the supplied figure number or figure window.
"""
if _fun.is_a_number(f): f = _pylab.figure(f)
f.canvas.manager.window.raise_() | [
"def",
"raise_figure_window",
"(",
"f",
"=",
"0",
")",
":",
"if",
"_fun",
".",
"is_a_number",
"(",
"f",
")",
":",
"f",
"=",
"_pylab",
".",
"figure",
"(",
"f",
")",
"f",
".",
"canvas",
".",
"manager",
".",
"window",
".",
"raise_",
"(",
")"
] | Raises the supplied figure number or figure window. | [
"Raises",
"the",
"supplied",
"figure",
"number",
"or",
"figure",
"window",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1028-L1033 | train |
Spinmob/spinmob | _pylab_tweaks.py | set_figure_window_geometry | def set_figure_window_geometry(fig='gcf', position=None, size=None):
"""
This will currently only work for Qt4Agg and WXAgg backends.
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object.
"""
if type(fig)==str: fig = _pylab.gcf()
elif _fun... | python | def set_figure_window_geometry(fig='gcf', position=None, size=None):
"""
This will currently only work for Qt4Agg and WXAgg backends.
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object.
"""
if type(fig)==str: fig = _pylab.gcf()
elif _fun... | [
"def",
"set_figure_window_geometry",
"(",
"fig",
"=",
"'gcf'",
",",
"position",
"=",
"None",
",",
"size",
"=",
"None",
")",
":",
"if",
"type",
"(",
"fig",
")",
"==",
"str",
":",
"fig",
"=",
"_pylab",
".",
"gcf",
"(",
")",
"elif",
"_fun",
".",
"is_a... | This will currently only work for Qt4Agg and WXAgg backends.
postion = [x, y]
size = [width, height]
fig can be 'gcf', a number, or a figure object. | [
"This",
"will",
"currently",
"only",
"work",
"for",
"Qt4Agg",
"and",
"WXAgg",
"backends",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1158-L1189 | train |
Spinmob/spinmob | _pylab_tweaks.py | line_math | def line_math(fx=None, fy=None, axes='gca'):
"""
applies function fx to all xdata and fy to all ydata.
"""
if axes=='gca': axes = _pylab.gca()
lines = axes.get_lines()
for line in lines:
if isinstance(line, _mpl.lines.Line2D):
xdata, ydata = line.get_data()
if ... | python | def line_math(fx=None, fy=None, axes='gca'):
"""
applies function fx to all xdata and fy to all ydata.
"""
if axes=='gca': axes = _pylab.gca()
lines = axes.get_lines()
for line in lines:
if isinstance(line, _mpl.lines.Line2D):
xdata, ydata = line.get_data()
if ... | [
"def",
"line_math",
"(",
"fx",
"=",
"None",
",",
"fy",
"=",
"None",
",",
"axes",
"=",
"'gca'",
")",
":",
"if",
"axes",
"==",
"'gca'",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"lines",
"=",
"axes",
".",
"get_lines",
"(",
")",
"for",
"li... | applies function fx to all xdata and fy to all ydata. | [
"applies",
"function",
"fx",
"to",
"all",
"xdata",
"and",
"fy",
"to",
"all",
"ydata",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1465-L1481 | train |
Spinmob/spinmob | _pylab_tweaks.py | export_figure | def export_figure(dpi=200, figure="gcf", path=None):
"""
Saves the actual postscript data for the figure.
"""
if figure=="gcf": figure = _pylab.gcf()
if path==None: path = _s.dialogs.Save("*.*", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
ret... | python | def export_figure(dpi=200, figure="gcf", path=None):
"""
Saves the actual postscript data for the figure.
"""
if figure=="gcf": figure = _pylab.gcf()
if path==None: path = _s.dialogs.Save("*.*", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
ret... | [
"def",
"export_figure",
"(",
"dpi",
"=",
"200",
",",
"figure",
"=",
"\"gcf\"",
",",
"path",
"=",
"None",
")",
":",
"if",
"figure",
"==",
"\"gcf\"",
":",
"figure",
"=",
"_pylab",
".",
"gcf",
"(",
")",
"if",
"path",
"==",
"None",
":",
"path",
"=",
... | Saves the actual postscript data for the figure. | [
"Saves",
"the",
"actual",
"postscript",
"data",
"for",
"the",
"figure",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1720-L1732 | train |
Spinmob/spinmob | _pylab_tweaks.py | save_plot | def save_plot(axes="gca", path=None):
"""
Saves the figure in my own ascii format
"""
global line_attributes
# choose a path to save to
if path==None: path = _s.dialogs.Save("*.plot", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
return
... | python | def save_plot(axes="gca", path=None):
"""
Saves the figure in my own ascii format
"""
global line_attributes
# choose a path to save to
if path==None: path = _s.dialogs.Save("*.plot", default_directory="save_plot_default_directory")
if path=="":
print("aborted.")
return
... | [
"def",
"save_plot",
"(",
"axes",
"=",
"\"gca\"",
",",
"path",
"=",
"None",
")",
":",
"global",
"line_attributes",
"if",
"path",
"==",
"None",
":",
"path",
"=",
"_s",
".",
"dialogs",
".",
"Save",
"(",
"\"*.plot\"",
",",
"default_directory",
"=",
"\"save_p... | Saves the figure in my own ascii format | [
"Saves",
"the",
"figure",
"in",
"my",
"own",
"ascii",
"format"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1734-L1774 | train |
Spinmob/spinmob | _pylab_tweaks.py | save_figure_raw_data | def save_figure_raw_data(figure="gcf", **kwargs):
"""
This will just output an ascii file for each of the traces in the shown figure.
**kwargs are sent to dialogs.Save()
"""
# choose a path to save to
path = _s.dialogs.Save(**kwargs)
if path=="": return "aborted."
# if no argument was... | python | def save_figure_raw_data(figure="gcf", **kwargs):
"""
This will just output an ascii file for each of the traces in the shown figure.
**kwargs are sent to dialogs.Save()
"""
# choose a path to save to
path = _s.dialogs.Save(**kwargs)
if path=="": return "aborted."
# if no argument was... | [
"def",
"save_figure_raw_data",
"(",
"figure",
"=",
"\"gcf\"",
",",
"**",
"kwargs",
")",
":",
"path",
"=",
"_s",
".",
"dialogs",
".",
"Save",
"(",
"**",
"kwargs",
")",
"if",
"path",
"==",
"\"\"",
":",
"return",
"\"aborted.\"",
"if",
"figure",
"==",
"\"g... | This will just output an ascii file for each of the traces in the shown figure.
**kwargs are sent to dialogs.Save() | [
"This",
"will",
"just",
"output",
"an",
"ascii",
"file",
"for",
"each",
"of",
"the",
"traces",
"in",
"the",
"shown",
"figure",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1776-L1807 | train |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.get_line_color | def get_line_color(self, increment=1):
"""
Returns the current color, then increments the color by what's specified
"""
i = self.line_colors_index
self.line_colors_index += increment
if self.line_colors_index >= len(self.line_colors):
self.line_colors_index ... | python | def get_line_color(self, increment=1):
"""
Returns the current color, then increments the color by what's specified
"""
i = self.line_colors_index
self.line_colors_index += increment
if self.line_colors_index >= len(self.line_colors):
self.line_colors_index ... | [
"def",
"get_line_color",
"(",
"self",
",",
"increment",
"=",
"1",
")",
":",
"i",
"=",
"self",
".",
"line_colors_index",
"self",
".",
"line_colors_index",
"+=",
"increment",
"if",
"self",
".",
"line_colors_index",
">=",
"len",
"(",
"self",
".",
"line_colors",... | Returns the current color, then increments the color by what's specified | [
"Returns",
"the",
"current",
"color",
"then",
"increments",
"the",
"color",
"by",
"what",
"s",
"specified"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L1989-L2001 | train |
Spinmob/spinmob | _pylab_tweaks.py | style_cycle.apply | def apply(self, axes="gca"):
"""
Applies the style cycle to the lines in the axes specified
"""
if axes == "gca": axes = _pylab.gca()
self.reset()
lines = axes.get_lines()
for l in lines:
l.set_color(self.get_line_color(1))
l.set_mfc(self... | python | def apply(self, axes="gca"):
"""
Applies the style cycle to the lines in the axes specified
"""
if axes == "gca": axes = _pylab.gca()
self.reset()
lines = axes.get_lines()
for l in lines:
l.set_color(self.get_line_color(1))
l.set_mfc(self... | [
"def",
"apply",
"(",
"self",
",",
"axes",
"=",
"\"gca\"",
")",
":",
"if",
"axes",
"==",
"\"gca\"",
":",
"axes",
"=",
"_pylab",
".",
"gca",
"(",
")",
"self",
".",
"reset",
"(",
")",
"lines",
"=",
"axes",
".",
"get_lines",
"(",
")",
"for",
"l",
"... | Applies the style cycle to the lines in the axes specified | [
"Applies",
"the",
"style",
"cycle",
"to",
"the",
"lines",
"in",
"the",
"axes",
"specified"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L2082-L2098 | train |
Spinmob/spinmob | _spline.py | copy_spline_array | def copy_spline_array(a):
"""
This returns an instance of a new spline_array with all the fixins, and the data from a.
"""
b = spline_array()
b.x_splines = a.x_splines
b.y_splines = a.y_splines
b.max_y_splines = a.max_y_splines
b.xmin = a.xmin
b.xmax = a.xmax
b.ymin = a.ym... | python | def copy_spline_array(a):
"""
This returns an instance of a new spline_array with all the fixins, and the data from a.
"""
b = spline_array()
b.x_splines = a.x_splines
b.y_splines = a.y_splines
b.max_y_splines = a.max_y_splines
b.xmin = a.xmin
b.xmax = a.xmax
b.ymin = a.ym... | [
"def",
"copy_spline_array",
"(",
"a",
")",
":",
"b",
"=",
"spline_array",
"(",
")",
"b",
".",
"x_splines",
"=",
"a",
".",
"x_splines",
"b",
".",
"y_splines",
"=",
"a",
".",
"y_splines",
"b",
".",
"max_y_splines",
"=",
"a",
".",
"max_y_splines",
"b",
... | This returns an instance of a new spline_array with all the fixins, and the data from a. | [
"This",
"returns",
"an",
"instance",
"of",
"a",
"new",
"spline_array",
"with",
"all",
"the",
"fixins",
"and",
"the",
"data",
"from",
"a",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L343-L365 | train |
Spinmob/spinmob | _spline.py | splot | def splot(axes="gca", smoothing=5000, degree=5, presmoothing=0, plot=True, spline_class=spline_single, interactive=True, show_derivative=1):
"""
gets the data from the plot and feeds it into splint
returns an instance of spline_single
axes="gca" which axes to get the data from.
... | python | def splot(axes="gca", smoothing=5000, degree=5, presmoothing=0, plot=True, spline_class=spline_single, interactive=True, show_derivative=1):
"""
gets the data from the plot and feeds it into splint
returns an instance of spline_single
axes="gca" which axes to get the data from.
... | [
"def",
"splot",
"(",
"axes",
"=",
"\"gca\"",
",",
"smoothing",
"=",
"5000",
",",
"degree",
"=",
"5",
",",
"presmoothing",
"=",
"0",
",",
"plot",
"=",
"True",
",",
"spline_class",
"=",
"spline_single",
",",
"interactive",
"=",
"True",
",",
"show_derivativ... | gets the data from the plot and feeds it into splint
returns an instance of spline_single
axes="gca" which axes to get the data from.
smoothing=5000 spline_single smoothing parameter
presmoothing=0 spline_single data presmoothing factor (nearest neighbor)
... | [
"gets",
"the",
"data",
"from",
"the",
"plot",
"and",
"feeds",
"it",
"into",
"splint",
"returns",
"an",
"instance",
"of",
"spline_single"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L532-L558 | train |
Spinmob/spinmob | _spline.py | spline_single.evaluate | def evaluate(self, x, derivative=0, smooth=0, simple='auto'):
"""
smooth=0 is how much to smooth the spline data
simple='auto' is whether we should just use straight interpolation
you may want smooth > 0 for this, when derivative=1
"""
if simple==... | python | def evaluate(self, x, derivative=0, smooth=0, simple='auto'):
"""
smooth=0 is how much to smooth the spline data
simple='auto' is whether we should just use straight interpolation
you may want smooth > 0 for this, when derivative=1
"""
if simple==... | [
"def",
"evaluate",
"(",
"self",
",",
"x",
",",
"derivative",
"=",
"0",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
")",
":",
"if",
"simple",
"==",
"'auto'",
":",
"simple",
"=",
"self",
".",
"simple",
"is_array",
"=",
"True",
"if",
"not",... | smooth=0 is how much to smooth the spline data
simple='auto' is whether we should just use straight interpolation
you may want smooth > 0 for this, when derivative=1 | [
"smooth",
"=",
"0",
"is",
"how",
"much",
"to",
"smooth",
"the",
"spline",
"data",
"simple",
"=",
"auto",
"is",
"whether",
"we",
"should",
"just",
"use",
"straight",
"interpolation",
"you",
"may",
"want",
"smooth",
">",
"0",
"for",
"this",
"when",
"deriva... | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L77-L151 | train |
Spinmob/spinmob | _spline.py | spline_array.evaluate | def evaluate(self, x, y, x_derivative=0, smooth=0, simple='auto'):
"""
this evaluates the 2-d spline by doing linear interpolation of the curves
"""
if simple=='auto': simple = self.simple
# find which values y is in between
for n in range(0, len(self.y_va... | python | def evaluate(self, x, y, x_derivative=0, smooth=0, simple='auto'):
"""
this evaluates the 2-d spline by doing linear interpolation of the curves
"""
if simple=='auto': simple = self.simple
# find which values y is in between
for n in range(0, len(self.y_va... | [
"def",
"evaluate",
"(",
"self",
",",
"x",
",",
"y",
",",
"x_derivative",
"=",
"0",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
")",
":",
"if",
"simple",
"==",
"'auto'",
":",
"simple",
"=",
"self",
".",
"simple",
"for",
"n",
"in",
"rang... | this evaluates the 2-d spline by doing linear interpolation of the curves | [
"this",
"evaluates",
"the",
"2",
"-",
"d",
"spline",
"by",
"doing",
"linear",
"interpolation",
"of",
"the",
"curves"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L239-L258 | train |
Spinmob/spinmob | _spline.py | spline_array.plot_fixed_x | def plot_fixed_x(self, x_values, x_derivative=0, steps=1000, smooth=0, simple='auto', ymin="auto", ymax="auto", format=True, clear=1):
"""
plots the data at fixed x-value, so z vs x
"""
if simple=='auto': simple=self.simple
# get the min and max
if ymin=="auto": ... | python | def plot_fixed_x(self, x_values, x_derivative=0, steps=1000, smooth=0, simple='auto', ymin="auto", ymax="auto", format=True, clear=1):
"""
plots the data at fixed x-value, so z vs x
"""
if simple=='auto': simple=self.simple
# get the min and max
if ymin=="auto": ... | [
"def",
"plot_fixed_x",
"(",
"self",
",",
"x_values",
",",
"x_derivative",
"=",
"0",
",",
"steps",
"=",
"1000",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
",",
"ymin",
"=",
"\"auto\"",
",",
"ymax",
"=",
"\"auto\"",
",",
"format",
"=",
"Tru... | plots the data at fixed x-value, so z vs x | [
"plots",
"the",
"data",
"at",
"fixed",
"x",
"-",
"value",
"so",
"z",
"vs",
"x"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L261-L289 | train |
Spinmob/spinmob | _spline.py | spline_array.plot_fixed_y | def plot_fixed_y(self, y_values, x_derivative=0, steps=1000, smooth=0, simple='auto', xmin="auto", xmax="auto", format=True, clear=1):
"""
plots the data at a fixed y-value, so z vs y
"""
if simple=='auto': simple=self.simple
# get the min and max
if xmin=="auto": xmin ... | python | def plot_fixed_y(self, y_values, x_derivative=0, steps=1000, smooth=0, simple='auto', xmin="auto", xmax="auto", format=True, clear=1):
"""
plots the data at a fixed y-value, so z vs y
"""
if simple=='auto': simple=self.simple
# get the min and max
if xmin=="auto": xmin ... | [
"def",
"plot_fixed_y",
"(",
"self",
",",
"y_values",
",",
"x_derivative",
"=",
"0",
",",
"steps",
"=",
"1000",
",",
"smooth",
"=",
"0",
",",
"simple",
"=",
"'auto'",
",",
"xmin",
"=",
"\"auto\"",
",",
"xmax",
"=",
"\"auto\"",
",",
"format",
"=",
"Tru... | plots the data at a fixed y-value, so z vs y | [
"plots",
"the",
"data",
"at",
"a",
"fixed",
"y",
"-",
"value",
"so",
"z",
"vs",
"y"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_spline.py#L298-L329 | train |
Spinmob/spinmob | egg/_gui.py | BaseObject.get_window | def get_window(self):
"""
Returns the object's parent window. Returns None if no window found.
"""
x = self
while not x._parent == None and \
not isinstance(x._parent, Window):
x = x._parent
return x._parent | python | def get_window(self):
"""
Returns the object's parent window. Returns None if no window found.
"""
x = self
while not x._parent == None and \
not isinstance(x._parent, Window):
x = x._parent
return x._parent | [
"def",
"get_window",
"(",
"self",
")",
":",
"x",
"=",
"self",
"while",
"not",
"x",
".",
"_parent",
"==",
"None",
"and",
"not",
"isinstance",
"(",
"x",
".",
"_parent",
",",
"Window",
")",
":",
"x",
"=",
"x",
".",
"_parent",
"return",
"x",
".",
"_p... | Returns the object's parent window. Returns None if no window found. | [
"Returns",
"the",
"object",
"s",
"parent",
"window",
".",
"Returns",
"None",
"if",
"no",
"window",
"found",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L93-L101 | train |
Spinmob/spinmob | egg/_gui.py | BaseObject.block_events | def block_events(self):
"""
Prevents the widget from sending signals.
"""
self._widget.blockSignals(True)
self._widget.setUpdatesEnabled(False) | python | def block_events(self):
"""
Prevents the widget from sending signals.
"""
self._widget.blockSignals(True)
self._widget.setUpdatesEnabled(False) | [
"def",
"block_events",
"(",
"self",
")",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"True",
")",
"self",
".",
"_widget",
".",
"setUpdatesEnabled",
"(",
"False",
")"
] | Prevents the widget from sending signals. | [
"Prevents",
"the",
"widget",
"from",
"sending",
"signals",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L132-L137 | train |
Spinmob/spinmob | egg/_gui.py | BaseObject.unblock_events | def unblock_events(self):
"""
Allows the widget to send signals.
"""
self._widget.blockSignals(False)
self._widget.setUpdatesEnabled(True) | python | def unblock_events(self):
"""
Allows the widget to send signals.
"""
self._widget.blockSignals(False)
self._widget.setUpdatesEnabled(True) | [
"def",
"unblock_events",
"(",
"self",
")",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"False",
")",
"self",
".",
"_widget",
".",
"setUpdatesEnabled",
"(",
"True",
")"
] | Allows the widget to send signals. | [
"Allows",
"the",
"widget",
"to",
"send",
"signals",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L139-L144 | train |
Spinmob/spinmob | egg/_gui.py | BaseObject.print_message | def print_message(self, message="heya!"):
"""
If self.log is defined to be an instance of TextLog, it print the
message there. Otherwise use the usual "print" to command line.
"""
if self.log == None: print(message)
else: self.log.append_text(message) | python | def print_message(self, message="heya!"):
"""
If self.log is defined to be an instance of TextLog, it print the
message there. Otherwise use the usual "print" to command line.
"""
if self.log == None: print(message)
else: self.log.append_text(message) | [
"def",
"print_message",
"(",
"self",
",",
"message",
"=",
"\"heya!\"",
")",
":",
"if",
"self",
".",
"log",
"==",
"None",
":",
"print",
"(",
"message",
")",
"else",
":",
"self",
".",
"log",
".",
"append_text",
"(",
"message",
")"
] | If self.log is defined to be an instance of TextLog, it print the
message there. Otherwise use the usual "print" to command line. | [
"If",
"self",
".",
"log",
"is",
"defined",
"to",
"be",
"an",
"instance",
"of",
"TextLog",
"it",
"print",
"the",
"message",
"there",
".",
"Otherwise",
"use",
"the",
"usual",
"print",
"to",
"command",
"line",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L170-L176 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.