repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
astropy/astropy-helpers
astropy_helpers/utils.py
extends_doc
def extends_doc(extended_func): """ A function decorator for use when wrapping an existing function but adding additional functionality. This copies the docstring from the original function, and appends to it (along with a newline) the docstring of the wrapper function. Examples -------- ...
python
def extends_doc(extended_func): """ A function decorator for use when wrapping an existing function but adding additional functionality. This copies the docstring from the original function, and appends to it (along with a newline) the docstring of the wrapper function. Examples -------- ...
[ "def", "extends_doc", "(", "extended_func", ")", ":", "def", "decorator", "(", "func", ")", ":", "if", "not", "(", "extended_func", ".", "__doc__", "is", "None", "or", "func", ".", "__doc__", "is", "None", ")", ":", "func", ".", "__doc__", "=", "'\\n\\...
A function decorator for use when wrapping an existing function but adding additional functionality. This copies the docstring from the original function, and appends to it (along with a newline) the docstring of the wrapper function. Examples -------- >>> def foo(): ... '''He...
[ "A", "function", "decorator", "for", "use", "when", "wrapping", "an", "existing", "function", "but", "adding", "additional", "functionality", ".", "This", "copies", "the", "docstring", "from", "the", "original", "function", "and", "appends", "to", "it", "(", "...
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/utils.py#L264-L294
astropy/astropy-helpers
astropy_helpers/utils.py
find_data_files
def find_data_files(package, pattern): """ Include files matching ``pattern`` inside ``package``. Parameters ---------- package : str The package inside which to look for data files pattern : str Pattern (glob-style) to match for the data files (e.g. ``*.dat``). This sup...
python
def find_data_files(package, pattern): """ Include files matching ``pattern`` inside ``package``. Parameters ---------- package : str The package inside which to look for data files pattern : str Pattern (glob-style) to match for the data files (e.g. ``*.dat``). This sup...
[ "def", "find_data_files", "(", "package", ",", "pattern", ")", ":", "return", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "package", ",", "pattern", ")", ",", "recursive", "=", "True", ")" ]
Include files matching ``pattern`` inside ``package``. Parameters ---------- package : str The package inside which to look for data files pattern : str Pattern (glob-style) to match for the data files (e.g. ``*.dat``). This supports the``**``recursive syntax. For example, ``**/...
[ "Include", "files", "matching", "pattern", "inside", "package", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/utils.py#L297-L312
astropy/astropy-helpers
astropy_helpers/version_helpers.py
_version_split
def _version_split(version): """ Split a version string into major, minor, and bugfix numbers. If any of those numbers are missing the default is zero. Any pre/post release modifiers are ignored. Examples ======== >>> _version_split('1.2.3') (1, 2, 3) >>> _version_split('1.2') ...
python
def _version_split(version): """ Split a version string into major, minor, and bugfix numbers. If any of those numbers are missing the default is zero. Any pre/post release modifiers are ignored. Examples ======== >>> _version_split('1.2.3') (1, 2, 3) >>> _version_split('1.2') ...
[ "def", "_version_split", "(", "version", ")", ":", "parsed_version", "=", "pkg_resources", ".", "parse_version", "(", "version", ")", "if", "hasattr", "(", "parsed_version", ",", "'base_version'", ")", ":", "# New version parsing for setuptools >= 8.0", "if", "parsed_...
Split a version string into major, minor, and bugfix numbers. If any of those numbers are missing the default is zero. Any pre/post release modifiers are ignored. Examples ======== >>> _version_split('1.2.3') (1, 2, 3) >>> _version_split('1.2') (1, 2, 0) >>> _version_split('1.2rc1...
[ "Split", "a", "version", "string", "into", "major", "minor", "and", "bugfix", "numbers", ".", "If", "any", "of", "those", "numbers", "are", "missing", "the", "default", "is", "zero", ".", "Any", "pre", "/", "post", "release", "modifiers", "are", "ignored",...
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/version_helpers.py#L43-L85
astropy/astropy-helpers
astropy_helpers/version_helpers.py
_generate_git_header
def _generate_git_header(packagename, version, githash): """ Generates a header to the version.py module that includes utilities for probing the git repository for updates (to the current git hash, etc.) These utilities should only be available in development versions, and not in release builds. ...
python
def _generate_git_header(packagename, version, githash): """ Generates a header to the version.py module that includes utilities for probing the git repository for updates (to the current git hash, etc.) These utilities should only be available in development versions, and not in release builds. ...
[ "def", "_generate_git_header", "(", "packagename", ",", "version", ",", "githash", ")", ":", "loader", "=", "pkgutil", ".", "get_loader", "(", "git_helpers", ")", "source", "=", "loader", ".", "get_source", "(", "git_helpers", ".", "__name__", ")", "or", "''...
Generates a header to the version.py module that includes utilities for probing the git repository for updates (to the current git hash, etc.) These utilities should only be available in development versions, and not in release builds. If this fails for any reason an empty string is returned.
[ "Generates", "a", "header", "to", "the", "version", ".", "py", "module", "that", "includes", "utilities", "for", "probing", "the", "git", "repository", "for", "updates", "(", "to", "the", "current", "git", "hash", "etc", ".", ")", "These", "utilities", "sh...
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/version_helpers.py#L182-L215
astropy/astropy-helpers
astropy_helpers/version_helpers.py
generate_version_py
def generate_version_py(packagename=None, version=None, release=None, debug=None, uses_git=None, srcdir='.'): """ Generate a version.py file in the package with version information, and update developer version strings. This function should normally be called without any argumen...
python
def generate_version_py(packagename=None, version=None, release=None, debug=None, uses_git=None, srcdir='.'): """ Generate a version.py file in the package with version information, and update developer version strings. This function should normally be called without any argumen...
[ "def", "generate_version_py", "(", "packagename", "=", "None", ",", "version", "=", "None", ",", "release", "=", "None", ",", "debug", "=", "None", ",", "uses_git", "=", "None", ",", "srcdir", "=", "'.'", ")", ":", "if", "packagename", "is", "not", "No...
Generate a version.py file in the package with version information, and update developer version strings. This function should normally be called without any arguments. In this case the package name and version is read in from the ``setup.cfg`` file (from the ``name`` or ``package_name`` entry and the ...
[ "Generate", "a", "version", ".", "py", "file", "in", "the", "package", "with", "version", "information", "and", "update", "developer", "version", "strings", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/version_helpers.py#L218-L349
astropy/astropy-helpers
astropy_helpers/version_helpers.py
get_pkg_version_module
def get_pkg_version_module(packagename, fromlist=None): """Returns the package's .version module generated by `astropy_helpers.version_helpers.generate_version_py`. Raises an ImportError if the version module is not found. If ``fromlist`` is an iterable, return a tuple of the members of the versio...
python
def get_pkg_version_module(packagename, fromlist=None): """Returns the package's .version module generated by `astropy_helpers.version_helpers.generate_version_py`. Raises an ImportError if the version module is not found. If ``fromlist`` is an iterable, return a tuple of the members of the versio...
[ "def", "get_pkg_version_module", "(", "packagename", ",", "fromlist", "=", "None", ")", ":", "version", "=", "import_file", "(", "os", ".", "path", ".", "join", "(", "packagename", ",", "'version.py'", ")", ",", "name", "=", "'version'", ")", "if", "fromli...
Returns the package's .version module generated by `astropy_helpers.version_helpers.generate_version_py`. Raises an ImportError if the version module is not found. If ``fromlist`` is an iterable, return a tuple of the members of the version module corresponding to the member names given in ``fromlist`...
[ "Returns", "the", "package", "s", ".", "version", "module", "generated", "by", "astropy_helpers", ".", "version_helpers", ".", "generate_version_py", ".", "Raises", "an", "ImportError", "if", "the", "version", "module", "is", "not", "found", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/version_helpers.py#L352-L367
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
setup
def setup(**kwargs): """ A wrapper around setuptools' setup() function that automatically sets up custom commands, generates a version file, and customizes the setup process via the ``setup_package.py`` files. """ # DEPRECATED: store the package name in a built-in variable so it's easy # to...
python
def setup(**kwargs): """ A wrapper around setuptools' setup() function that automatically sets up custom commands, generates a version file, and customizes the setup process via the ``setup_package.py`` files. """ # DEPRECATED: store the package name in a built-in variable so it's easy # to...
[ "def", "setup", "(", "*", "*", "kwargs", ")", ":", "# DEPRECATED: store the package name in a built-in variable so it's easy", "# to get from other parts of the setup infrastructure. We should phase this", "# out in packages that use it - the cookiecutter template should now be", "# able to pu...
A wrapper around setuptools' setup() function that automatically sets up custom commands, generates a version file, and customizes the setup process via the ``setup_package.py`` files.
[ "A", "wrapper", "around", "setuptools", "setup", "()", "function", "that", "automatically", "sets", "up", "custom", "commands", "generates", "a", "version", "file", "and", "customizes", "the", "setup", "process", "via", "the", "setup_package", ".", "py", "files"...
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L72-L104
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
get_debug_option
def get_debug_option(packagename): """ Determines if the build is in debug mode. Returns ------- debug : bool True if the current build was started with the debug option, False otherwise. """ try: current_debug = get_pkg_version_module(packagename, ...
python
def get_debug_option(packagename): """ Determines if the build is in debug mode. Returns ------- debug : bool True if the current build was started with the debug option, False otherwise. """ try: current_debug = get_pkg_version_module(packagename, ...
[ "def", "get_debug_option", "(", "packagename", ")", ":", "try", ":", "current_debug", "=", "get_pkg_version_module", "(", "packagename", ",", "fromlist", "=", "[", "'debug'", "]", ")", "[", "0", "]", "except", "(", "ImportError", ",", "AttributeError", ")", ...
Determines if the build is in debug mode. Returns ------- debug : bool True if the current build was started with the debug option, False otherwise.
[ "Determines", "if", "the", "build", "is", "in", "debug", "mode", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L114-L143
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
register_commands
def register_commands(package=None, version=None, release=None, srcdir='.'): """ This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``. """ if package is not None: warnings.warn('The package argument to genera...
python
def register_commands(package=None, version=None, release=None, srcdir='.'): """ This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``. """ if package is not None: warnings.warn('The package argument to genera...
[ "def", "register_commands", "(", "package", "=", "None", ",", "version", "=", "None", ",", "release", "=", "None", ",", "srcdir", "=", "'.'", ")", ":", "if", "package", "is", "not", "None", ":", "warnings", ".", "warn", "(", "'The package argument to gener...
This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``.
[ "This", "function", "generates", "a", "dictionary", "containing", "customized", "commands", "that", "can", "then", "be", "passed", "to", "the", "cmdclass", "argument", "in", "setup", "()", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L156-L241
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
add_command_hooks
def add_command_hooks(commands, srcdir='.'): """ Look through setup_package.py modules for functions with names like ``pre_<command_name>_hook`` and ``post_<command_name>_hook`` where ``<command_name>`` is the name of a ``setup.py`` command (e.g. build_ext). If either hook is present this adds a wr...
python
def add_command_hooks(commands, srcdir='.'): """ Look through setup_package.py modules for functions with names like ``pre_<command_name>_hook`` and ``post_<command_name>_hook`` where ``<command_name>`` is the name of a ``setup.py`` command (e.g. build_ext). If either hook is present this adds a wr...
[ "def", "add_command_hooks", "(", "commands", ",", "srcdir", "=", "'.'", ")", ":", "hook_re", "=", "re", ".", "compile", "(", "r'^(pre|post)_(.+)_hook$'", ")", "# Distutils commands have a method of the same name, but it is not a", "# *classmethod* (which probably didn't exist w...
Look through setup_package.py modules for functions with names like ``pre_<command_name>_hook`` and ``post_<command_name>_hook`` where ``<command_name>`` is the name of a ``setup.py`` command (e.g. build_ext). If either hook is present this adds a wrapped version of that command to the passed in ``comm...
[ "Look", "through", "setup_package", ".", "py", "modules", "for", "functions", "with", "names", "like", "pre_<command_name", ">", "_hook", "and", "post_<command_name", ">", "_hook", "where", "<command_name", ">", "is", "the", "name", "of", "a", "setup", ".", "p...
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L244-L288
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
generate_hooked_command
def generate_hooked_command(cmd_name, cmd_cls, hooks): """ Returns a generated subclass of ``cmd_cls`` that runs the pre- and post-command hooks for that command before and after the ``cmd_cls.run`` method. """ def run(self, orig_run=cmd_cls.run): self.run_command_hooks('pre_hooks') ...
python
def generate_hooked_command(cmd_name, cmd_cls, hooks): """ Returns a generated subclass of ``cmd_cls`` that runs the pre- and post-command hooks for that command before and after the ``cmd_cls.run`` method. """ def run(self, orig_run=cmd_cls.run): self.run_command_hooks('pre_hooks') ...
[ "def", "generate_hooked_command", "(", "cmd_name", ",", "cmd_cls", ",", "hooks", ")", ":", "def", "run", "(", "self", ",", "orig_run", "=", "cmd_cls", ".", "run", ")", ":", "self", ".", "run_command_hooks", "(", "'pre_hooks'", ")", "orig_run", "(", "self",...
Returns a generated subclass of ``cmd_cls`` that runs the pre- and post-command hooks for that command before and after the ``cmd_cls.run`` method.
[ "Returns", "a", "generated", "subclass", "of", "cmd_cls", "that", "runs", "the", "pre", "-", "and", "post", "-", "command", "hooks", "for", "that", "command", "before", "and", "after", "the", "cmd_cls", ".", "run", "method", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L291-L306
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
run_command_hooks
def run_command_hooks(cmd_obj, hook_kind): """Run hooks registered for that command and phase. *cmd_obj* is a finalized command object; *hook_kind* is either 'pre_hook' or 'post_hook'. """ hooks = getattr(cmd_obj, hook_kind, None) if not hooks: return for modname, hook in hooks: ...
python
def run_command_hooks(cmd_obj, hook_kind): """Run hooks registered for that command and phase. *cmd_obj* is a finalized command object; *hook_kind* is either 'pre_hook' or 'post_hook'. """ hooks = getattr(cmd_obj, hook_kind, None) if not hooks: return for modname, hook in hooks: ...
[ "def", "run_command_hooks", "(", "cmd_obj", ",", "hook_kind", ")", ":", "hooks", "=", "getattr", "(", "cmd_obj", ",", "hook_kind", ",", "None", ")", "if", "not", "hooks", ":", "return", "for", "modname", ",", "hook", "in", "hooks", ":", "if", "isinstance...
Run hooks registered for that command and phase. *cmd_obj* is a finalized command object; *hook_kind* is either 'pre_hook' or 'post_hook'.
[ "Run", "hooks", "registered", "for", "that", "command", "and", "phase", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L309-L343
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
update_package_files
def update_package_files(srcdir, extensions, package_data, packagenames, package_dirs): """ This function is deprecated and maintained for backward compatibility with affiliated packages. Affiliated packages should update their setup.py to use `get_package_info` instead. ""...
python
def update_package_files(srcdir, extensions, package_data, packagenames, package_dirs): """ This function is deprecated and maintained for backward compatibility with affiliated packages. Affiliated packages should update their setup.py to use `get_package_info` instead. ""...
[ "def", "update_package_files", "(", "srcdir", ",", "extensions", ",", "package_data", ",", "packagenames", ",", "package_dirs", ")", ":", "info", "=", "get_package_info", "(", "srcdir", ")", "extensions", ".", "extend", "(", "info", "[", "'ext_modules'", "]", ...
This function is deprecated and maintained for backward compatibility with affiliated packages. Affiliated packages should update their setup.py to use `get_package_info` instead.
[ "This", "function", "is", "deprecated", "and", "maintained", "for", "backward", "compatibility", "with", "affiliated", "packages", ".", "Affiliated", "packages", "should", "update", "their", "setup", ".", "py", "to", "use", "get_package_info", "instead", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L357-L369
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
get_package_info
def get_package_info(srcdir='.', exclude=()): """ Collates all of the information for building all subpackages and returns a dictionary of keyword arguments that can be passed directly to `distutils.setup`. The purpose of this function is to allow subpackages to update the arguments to the pack...
python
def get_package_info(srcdir='.', exclude=()): """ Collates all of the information for building all subpackages and returns a dictionary of keyword arguments that can be passed directly to `distutils.setup`. The purpose of this function is to allow subpackages to update the arguments to the pack...
[ "def", "get_package_info", "(", "srcdir", "=", "'.'", ",", "exclude", "=", "(", ")", ")", ":", "ext_modules", "=", "[", "]", "packages", "=", "[", "]", "package_dir", "=", "{", "}", "# Read in existing package data, and add to it below", "setup_cfg", "=", "os"...
Collates all of the information for building all subpackages and returns a dictionary of keyword arguments that can be passed directly to `distutils.setup`. The purpose of this function is to allow subpackages to update the arguments to the package's ``setup()`` function in its setup.py script, rat...
[ "Collates", "all", "of", "the", "information", "for", "building", "all", "subpackages", "and", "returns", "a", "dictionary", "of", "keyword", "arguments", "that", "can", "be", "passed", "directly", "to", "distutils", ".", "setup", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L372-L481
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
iter_setup_packages
def iter_setup_packages(srcdir, packages): """ A generator that finds and imports all of the ``setup_package.py`` modules in the source packages. Returns ------- modgen : generator A generator that yields (modname, mod), where `mod` is the module and `modname` is the module name for...
python
def iter_setup_packages(srcdir, packages): """ A generator that finds and imports all of the ``setup_package.py`` modules in the source packages. Returns ------- modgen : generator A generator that yields (modname, mod), where `mod` is the module and `modname` is the module name for...
[ "def", "iter_setup_packages", "(", "srcdir", ",", "packages", ")", ":", "for", "packagename", "in", "packages", ":", "package_parts", "=", "packagename", ".", "split", "(", "'.'", ")", "package_path", "=", "os", ".", "path", ".", "join", "(", "srcdir", ","...
A generator that finds and imports all of the ``setup_package.py`` modules in the source packages. Returns ------- modgen : generator A generator that yields (modname, mod), where `mod` is the module and `modname` is the module name for the ``setup_package.py`` modules.
[ "A", "generator", "that", "finds", "and", "imports", "all", "of", "the", "setup_package", ".", "py", "modules", "in", "the", "source", "packages", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L484-L505
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
iter_pyx_files
def iter_pyx_files(package_dir, package_name): """ A generator that yields Cython source files (ending in '.pyx') in the source packages. Returns ------- pyxgen : generator A generator that yields (extmod, fullfn) where `extmod` is the full name of the module that the .pyx file ...
python
def iter_pyx_files(package_dir, package_name): """ A generator that yields Cython source files (ending in '.pyx') in the source packages. Returns ------- pyxgen : generator A generator that yields (extmod, fullfn) where `extmod` is the full name of the module that the .pyx file ...
[ "def", "iter_pyx_files", "(", "package_dir", ",", "package_name", ")", ":", "for", "dirpath", ",", "dirnames", ",", "filenames", "in", "walk_skip_hidden", "(", "package_dir", ")", ":", "for", "fn", "in", "filenames", ":", "if", "fn", ".", "endswith", "(", ...
A generator that yields Cython source files (ending in '.pyx') in the source packages. Returns ------- pyxgen : generator A generator that yields (extmod, fullfn) where `extmod` is the full name of the module that the .pyx file would live in based on the source directory structu...
[ "A", "generator", "that", "yields", "Cython", "source", "files", "(", "ending", "in", ".", "pyx", ")", "in", "the", "source", "packages", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L508-L529
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
get_cython_extensions
def get_cython_extensions(srcdir, packages, prevextensions=tuple(), extincludedirs=None): """ Looks for Cython files and generates Extensions if needed. Parameters ---------- srcdir : str Path to the root of the source directory to search. prevextensions : list...
python
def get_cython_extensions(srcdir, packages, prevextensions=tuple(), extincludedirs=None): """ Looks for Cython files and generates Extensions if needed. Parameters ---------- srcdir : str Path to the root of the source directory to search. prevextensions : list...
[ "def", "get_cython_extensions", "(", "srcdir", ",", "packages", ",", "prevextensions", "=", "tuple", "(", ")", ",", "extincludedirs", "=", "None", ")", ":", "# Vanilla setuptools and old versions of distribute include Cython files", "# as .c files in the sources, not .pyx, so w...
Looks for Cython files and generates Extensions if needed. Parameters ---------- srcdir : str Path to the root of the source directory to search. prevextensions : list of `~distutils.core.Extension` objects The extensions that are already defined. Any .pyx files already here wi...
[ "Looks", "for", "Cython", "files", "and", "generates", "Extensions", "if", "needed", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L532-L579
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
pkg_config
def pkg_config(packages, default_libraries, executable='pkg-config'): """ Uses pkg-config to update a set of distutils Extension arguments to include the flags necessary to link against the given packages. If the pkg-config lookup fails, default_libraries is applied to libraries. Parameters ...
python
def pkg_config(packages, default_libraries, executable='pkg-config'): """ Uses pkg-config to update a set of distutils Extension arguments to include the flags necessary to link against the given packages. If the pkg-config lookup fails, default_libraries is applied to libraries. Parameters ...
[ "def", "pkg_config", "(", "packages", ",", "default_libraries", ",", "executable", "=", "'pkg-config'", ")", ":", "flag_map", "=", "{", "'-I'", ":", "'include_dirs'", ",", "'-L'", ":", "'library_dirs'", ",", "'-l'", ":", "'libraries'", ",", "'-D'", ":", "'de...
Uses pkg-config to update a set of distutils Extension arguments to include the flags necessary to link against the given packages. If the pkg-config lookup fails, default_libraries is applied to libraries. Parameters ---------- packages : list of str A list of pkg-config packages to l...
[ "Uses", "pkg", "-", "config", "to", "update", "a", "set", "of", "distutils", "Extension", "arguments", "to", "include", "the", "flags", "necessary", "to", "link", "against", "the", "given", "packages", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L602-L679
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
add_external_library
def add_external_library(library): """ Add a build option for selecting the internal or system copy of a library. Parameters ---------- library : str The name of the library. If the library is `foo`, the build option will be called `--use-system-foo`. """ for command in ['...
python
def add_external_library(library): """ Add a build option for selecting the internal or system copy of a library. Parameters ---------- library : str The name of the library. If the library is `foo`, the build option will be called `--use-system-foo`. """ for command in ['...
[ "def", "add_external_library", "(", "library", ")", ":", "for", "command", "in", "[", "'build'", ",", "'build_ext'", ",", "'install'", "]", ":", "add_command_option", "(", "command", ",", "str", "(", "'use-system-'", "+", "library", ")", ",", "'Use the system ...
Add a build option for selecting the internal or system copy of a library. Parameters ---------- library : str The name of the library. If the library is `foo`, the build option will be called `--use-system-foo`.
[ "Add", "a", "build", "option", "for", "selecting", "the", "internal", "or", "system", "copy", "of", "a", "library", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L682-L696
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
find_packages
def find_packages(where='.', exclude=(), invalidate_cache=False): """ This version of ``find_packages`` caches previous results to speed up subsequent calls. Use ``invalide_cache=True`` to ignore cached results from previous ``find_packages`` calls, and repeat the package search. """ if exclud...
python
def find_packages(where='.', exclude=(), invalidate_cache=False): """ This version of ``find_packages`` caches previous results to speed up subsequent calls. Use ``invalide_cache=True`` to ignore cached results from previous ``find_packages`` calls, and repeat the package search. """ if exclud...
[ "def", "find_packages", "(", "where", "=", "'.'", ",", "exclude", "=", "(", ")", ",", "invalidate_cache", "=", "False", ")", ":", "if", "exclude", ":", "warnings", ".", "warn", "(", "\"Use of the exclude parameter is no longer supported since it does \"", "\"not wor...
This version of ``find_packages`` caches previous results to speed up subsequent calls. Use ``invalide_cache=True`` to ignore cached results from previous ``find_packages`` calls, and repeat the package search.
[ "This", "version", "of", "find_packages", "caches", "previous", "results", "to", "speed", "up", "subsequent", "calls", ".", "Use", "invalide_cache", "=", "True", "to", "ignore", "cached", "results", "from", "previous", "find_packages", "calls", "and", "repeat", ...
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L725-L749
astropy/astropy-helpers
astropy_helpers/commands/build_ext.py
should_build_with_cython
def should_build_with_cython(previous_cython_version, is_release): """ Returns the previously used Cython version (or 'unknown' if not previously built) if Cython should be used to build extension modules from pyx files. """ # Only build with Cython if, of course, Cython is installed, we're in ...
python
def should_build_with_cython(previous_cython_version, is_release): """ Returns the previously used Cython version (or 'unknown' if not previously built) if Cython should be used to build extension modules from pyx files. """ # Only build with Cython if, of course, Cython is installed, we're in ...
[ "def", "should_build_with_cython", "(", "previous_cython_version", ",", "is_release", ")", ":", "# Only build with Cython if, of course, Cython is installed, we're in a", "# development version (i.e. not release) or the Cython-generated source", "# files haven't been created yet (cython_version ...
Returns the previously used Cython version (or 'unknown' if not previously built) if Cython should be used to build extension modules from pyx files.
[ "Returns", "the", "previously", "used", "Cython", "version", "(", "or", "unknown", "if", "not", "previously", "built", ")", "if", "Cython", "should", "be", "used", "to", "build", "extension", "modules", "from", "pyx", "files", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/commands/build_ext.py#L15-L37
astropy/astropy-helpers
astropy_helpers/commands/build_ext.py
AstropyHelpersBuildExt._check_cython_sources
def _check_cython_sources(self, extension): """ Where relevant, make sure that the .c files associated with .pyx modules are present (if building without Cython installed). """ # Determine the compiler we'll be using if self.compiler is None: compiler = get_d...
python
def _check_cython_sources(self, extension): """ Where relevant, make sure that the .c files associated with .pyx modules are present (if building without Cython installed). """ # Determine the compiler we'll be using if self.compiler is None: compiler = get_d...
[ "def", "_check_cython_sources", "(", "self", ",", "extension", ")", ":", "# Determine the compiler we'll be using", "if", "self", ".", "compiler", "is", "None", ":", "compiler", "=", "get_default_compiler", "(", ")", "else", ":", "compiler", "=", "self", ".", "c...
Where relevant, make sure that the .c files associated with .pyx modules are present (if building without Cython installed).
[ "Where", "relevant", "make", "sure", "that", "the", ".", "c", "files", "associated", "with", ".", "pyx", "modules", "are", "present", "(", "if", "building", "without", "Cython", "installed", ")", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/commands/build_ext.py#L162-L206
astropy/astropy-helpers
astropy_helpers/openmp_helpers.py
_get_flag_value_from_var
def _get_flag_value_from_var(flag, var, delim=' '): """ Extract flags from an environment variable. Parameters ---------- flag : str The flag to extract, for example '-I' or '-L' var : str The environment variable to extract the flag from, e.g. CFLAGS or LDFLAGS. delim : str...
python
def _get_flag_value_from_var(flag, var, delim=' '): """ Extract flags from an environment variable. Parameters ---------- flag : str The flag to extract, for example '-I' or '-L' var : str The environment variable to extract the flag from, e.g. CFLAGS or LDFLAGS. delim : str...
[ "def", "_get_flag_value_from_var", "(", "flag", ",", "var", ",", "delim", "=", "' '", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "'win'", ")", ":", "return", "None", "# Simple input validation", "if", "not", "var", "or", "not", "flag",...
Extract flags from an environment variable. Parameters ---------- flag : str The flag to extract, for example '-I' or '-L' var : str The environment variable to extract the flag from, e.g. CFLAGS or LDFLAGS. delim : str, optional The delimiter separating flags inside the env...
[ "Extract", "flags", "from", "an", "environment", "variable", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/openmp_helpers.py#L52-L104
astropy/astropy-helpers
astropy_helpers/openmp_helpers.py
get_openmp_flags
def get_openmp_flags(): """ Utility for returning compiler and linker flags possibly needed for OpenMP support. Returns ------- result : `{'compiler_flags':<flags>, 'linker_flags':<flags>}` Notes ----- The flags returned are not tested for validity, use `check_openmp_support(op...
python
def get_openmp_flags(): """ Utility for returning compiler and linker flags possibly needed for OpenMP support. Returns ------- result : `{'compiler_flags':<flags>, 'linker_flags':<flags>}` Notes ----- The flags returned are not tested for validity, use `check_openmp_support(op...
[ "def", "get_openmp_flags", "(", ")", ":", "compile_flags", "=", "[", "]", "link_flags", "=", "[", "]", "if", "get_compiler_option", "(", ")", "==", "'msvc'", ":", "compile_flags", ".", "append", "(", "'-openmp'", ")", "else", ":", "include_path", "=", "_ge...
Utility for returning compiler and linker flags possibly needed for OpenMP support. Returns ------- result : `{'compiler_flags':<flags>, 'linker_flags':<flags>}` Notes ----- The flags returned are not tested for validity, use `check_openmp_support(openmp_flags=get_openmp_flags())` to d...
[ "Utility", "for", "returning", "compiler", "and", "linker", "flags", "possibly", "needed", "for", "OpenMP", "support", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/openmp_helpers.py#L107-L141
astropy/astropy-helpers
astropy_helpers/openmp_helpers.py
check_openmp_support
def check_openmp_support(openmp_flags=None): """ Check whether OpenMP test code can be compiled and run. Parameters ---------- openmp_flags : dict, optional This should be a dictionary with keys ``compiler_flags`` and ``linker_flags`` giving the compiliation and linking flags respec...
python
def check_openmp_support(openmp_flags=None): """ Check whether OpenMP test code can be compiled and run. Parameters ---------- openmp_flags : dict, optional This should be a dictionary with keys ``compiler_flags`` and ``linker_flags`` giving the compiliation and linking flags respec...
[ "def", "check_openmp_support", "(", "openmp_flags", "=", "None", ")", ":", "ccompiler", "=", "new_compiler", "(", ")", "customize_compiler", "(", "ccompiler", ")", "if", "not", "openmp_flags", ":", "# customize_compiler() extracts info from os.environ. If certain keys", "...
Check whether OpenMP test code can be compiled and run. Parameters ---------- openmp_flags : dict, optional This should be a dictionary with keys ``compiler_flags`` and ``linker_flags`` giving the compiliation and linking flags respectively. These are passed as `extra_postargs` to `...
[ "Check", "whether", "OpenMP", "test", "code", "can", "be", "compiled", "and", "run", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/openmp_helpers.py#L144-L227
astropy/astropy-helpers
astropy_helpers/openmp_helpers.py
is_openmp_supported
def is_openmp_supported(): """ Determine whether the build compiler has OpenMP support. """ log_threshold = log.set_threshold(log.FATAL) ret = check_openmp_support() log.set_threshold(log_threshold) return ret
python
def is_openmp_supported(): """ Determine whether the build compiler has OpenMP support. """ log_threshold = log.set_threshold(log.FATAL) ret = check_openmp_support() log.set_threshold(log_threshold) return ret
[ "def", "is_openmp_supported", "(", ")", ":", "log_threshold", "=", "log", ".", "set_threshold", "(", "log", ".", "FATAL", ")", "ret", "=", "check_openmp_support", "(", ")", "log", ".", "set_threshold", "(", "log_threshold", ")", "return", "ret" ]
Determine whether the build compiler has OpenMP support.
[ "Determine", "whether", "the", "build", "compiler", "has", "OpenMP", "support", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/openmp_helpers.py#L230-L237
astropy/astropy-helpers
astropy_helpers/openmp_helpers.py
add_openmp_flags_if_available
def add_openmp_flags_if_available(extension): """ Add OpenMP compilation flags, if supported (if not a warning will be printed to the console and no flags will be added.) Returns `True` if the flags were added, `False` otherwise. """ if _ASTROPY_DISABLE_SETUP_WITH_OPENMP_: log.info("Op...
python
def add_openmp_flags_if_available(extension): """ Add OpenMP compilation flags, if supported (if not a warning will be printed to the console and no flags will be added.) Returns `True` if the flags were added, `False` otherwise. """ if _ASTROPY_DISABLE_SETUP_WITH_OPENMP_: log.info("Op...
[ "def", "add_openmp_flags_if_available", "(", "extension", ")", ":", "if", "_ASTROPY_DISABLE_SETUP_WITH_OPENMP_", ":", "log", ".", "info", "(", "\"OpenMP support has been explicitly disabled.\"", ")", "return", "False", "openmp_flags", "=", "get_openmp_flags", "(", ")", "u...
Add OpenMP compilation flags, if supported (if not a warning will be printed to the console and no flags will be added.) Returns `True` if the flags were added, `False` otherwise.
[ "Add", "OpenMP", "compilation", "flags", "if", "supported", "(", "if", "not", "a", "warning", "will", "be", "printed", "to", "the", "console", "and", "no", "flags", "will", "be", "added", ".", ")" ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/openmp_helpers.py#L240-L265
astropy/astropy-helpers
astropy_helpers/openmp_helpers.py
generate_openmp_enabled_py
def generate_openmp_enabled_py(packagename, srcdir='.', disable_openmp=None): """ Generate ``package.openmp_enabled.is_openmp_enabled``, which can then be used to determine, post build, whether the package was built with or without OpenMP support. """ if packagename.lower() == 'astropy': ...
python
def generate_openmp_enabled_py(packagename, srcdir='.', disable_openmp=None): """ Generate ``package.openmp_enabled.is_openmp_enabled``, which can then be used to determine, post build, whether the package was built with or without OpenMP support. """ if packagename.lower() == 'astropy': ...
[ "def", "generate_openmp_enabled_py", "(", "packagename", ",", "srcdir", "=", "'.'", ",", "disable_openmp", "=", "None", ")", ":", "if", "packagename", ".", "lower", "(", ")", "==", "'astropy'", ":", "packagetitle", "=", "'Astropy'", "else", ":", "packagetitle"...
Generate ``package.openmp_enabled.is_openmp_enabled``, which can then be used to determine, post build, whether the package was built with or without OpenMP support.
[ "Generate", "package", ".", "openmp_enabled", ".", "is_openmp_enabled", "which", "can", "then", "be", "used", "to", "determine", "post", "build", "whether", "the", "package", "was", "built", "with", "or", "without", "OpenMP", "support", "." ]
train
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/openmp_helpers.py#L279-L308
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeTable.GetValue
def GetValue(self, row, col): """ Find the matching value from pandas DataFrame, return it. """ if len(self.dataframe): return str(self.dataframe.iloc[row, col]) return ''
python
def GetValue(self, row, col): """ Find the matching value from pandas DataFrame, return it. """ if len(self.dataframe): return str(self.dataframe.iloc[row, col]) return ''
[ "def", "GetValue", "(", "self", ",", "row", ",", "col", ")", ":", "if", "len", "(", "self", ".", "dataframe", ")", ":", "return", "str", "(", "self", ".", "dataframe", ".", "iloc", "[", "row", ",", "col", "]", ")", "return", "''" ]
Find the matching value from pandas DataFrame, return it.
[ "Find", "the", "matching", "value", "from", "pandas", "DataFrame", "return", "it", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L43-L50
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeTable.SetValue
def SetValue(self, row, col, value): """ Set value in the pandas DataFrame """ self.dataframe.iloc[row, col] = value
python
def SetValue(self, row, col, value): """ Set value in the pandas DataFrame """ self.dataframe.iloc[row, col] = value
[ "def", "SetValue", "(", "self", ",", "row", ",", "col", ",", "value", ")", ":", "self", ".", "dataframe", ".", "iloc", "[", "row", ",", "col", "]", "=", "value" ]
Set value in the pandas DataFrame
[ "Set", "value", "in", "the", "pandas", "DataFrame" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L52-L56
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeTable.SetColumnValues
def SetColumnValues(self, col, value): """ Custom method to efficiently set all values in a column. Parameters ---------- col : str or int name or index position of column value : list-like values to assign to all cells in the column ...
python
def SetColumnValues(self, col, value): """ Custom method to efficiently set all values in a column. Parameters ---------- col : str or int name or index position of column value : list-like values to assign to all cells in the column ...
[ "def", "SetColumnValues", "(", "self", ",", "col", ",", "value", ")", ":", "try", ":", "self", ".", "dataframe", ".", "iloc", "[", ":", ",", "col", "]", "=", "value", "except", "ValueError", ":", "self", ".", "dataframe", ".", "loc", "[", ":", ",",...
Custom method to efficiently set all values in a column. Parameters ---------- col : str or int name or index position of column value : list-like values to assign to all cells in the column
[ "Custom", "method", "to", "efficiently", "set", "all", "values", "in", "a", "column", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L58-L73
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeTable.GetColLabelValue
def GetColLabelValue(self, col): """ Get col label from dataframe """ if len(self.dataframe): return self.dataframe.columns[col] return ''
python
def GetColLabelValue(self, col): """ Get col label from dataframe """ if len(self.dataframe): return self.dataframe.columns[col] return ''
[ "def", "GetColLabelValue", "(", "self", ",", "col", ")", ":", "if", "len", "(", "self", ".", "dataframe", ")", ":", "return", "self", ".", "dataframe", ".", "columns", "[", "col", "]", "return", "''" ]
Get col label from dataframe
[ "Get", "col", "label", "from", "dataframe" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L75-L81
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeTable.SetColLabelValue
def SetColLabelValue(self, col, value): """ Set col label value in dataframe """ if len(self.dataframe): col_name = str(self.dataframe.columns[col]) self.dataframe.rename(columns={col_name: str(value)}, inplace=True) return None
python
def SetColLabelValue(self, col, value): """ Set col label value in dataframe """ if len(self.dataframe): col_name = str(self.dataframe.columns[col]) self.dataframe.rename(columns={col_name: str(value)}, inplace=True) return None
[ "def", "SetColLabelValue", "(", "self", ",", "col", ",", "value", ")", ":", "if", "len", "(", "self", ".", "dataframe", ")", ":", "col_name", "=", "str", "(", "self", ".", "dataframe", ".", "columns", "[", "col", "]", ")", "self", ".", "dataframe", ...
Set col label value in dataframe
[ "Set", "col", "label", "value", "in", "dataframe" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L83-L90
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.set_scrollbars
def set_scrollbars(self): """ Set to always have vertical scrollbar. Have horizontal scrollbar unless grid has very few rows. Older versions of wxPython will choke on this, in which case nothing happens. """ try: if len(self.row_labels) < 5: ...
python
def set_scrollbars(self): """ Set to always have vertical scrollbar. Have horizontal scrollbar unless grid has very few rows. Older versions of wxPython will choke on this, in which case nothing happens. """ try: if len(self.row_labels) < 5: ...
[ "def", "set_scrollbars", "(", "self", ")", ":", "try", ":", "if", "len", "(", "self", ".", "row_labels", ")", "<", "5", ":", "show_horizontal", "=", "wx", ".", "SHOW_SB_NEVER", "else", ":", "show_horizontal", "=", "wx", ".", "SHOW_SB_DEFAULT", "self", "....
Set to always have vertical scrollbar. Have horizontal scrollbar unless grid has very few rows. Older versions of wxPython will choke on this, in which case nothing happens.
[ "Set", "to", "always", "have", "vertical", "scrollbar", ".", "Have", "horizontal", "scrollbar", "unless", "grid", "has", "very", "few", "rows", ".", "Older", "versions", "of", "wxPython", "will", "choke", "on", "this", "in", "which", "case", "nothing", "happ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L144-L158
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.add_items
def add_items(self, dataframe, hide_cols=()): """ Add items and/or update existing items in grid """ # replace "None" values with "" dataframe = dataframe.fillna("") # remove any columns that shouldn't be shown for col in hide_cols: if col in dataframe...
python
def add_items(self, dataframe, hide_cols=()): """ Add items and/or update existing items in grid """ # replace "None" values with "" dataframe = dataframe.fillna("") # remove any columns that shouldn't be shown for col in hide_cols: if col in dataframe...
[ "def", "add_items", "(", "self", ",", "dataframe", ",", "hide_cols", "=", "(", ")", ")", ":", "# replace \"None\" values with \"\"", "dataframe", "=", "dataframe", ".", "fillna", "(", "\"\"", ")", "# remove any columns that shouldn't be shown", "for", "col", "in", ...
Add items and/or update existing items in grid
[ "Add", "items", "and", "/", "or", "update", "existing", "items", "in", "grid" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L160-L191
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.save_items
def save_items(self, rows=None, verbose=False): """ Return a dictionary of row data for selected rows: {1: {col1: val1, col2: val2}, ...} If a list of row numbers isn't provided, get data for all. """ if rows: rows = rows else: rows = list(...
python
def save_items(self, rows=None, verbose=False): """ Return a dictionary of row data for selected rows: {1: {col1: val1, col2: val2}, ...} If a list of row numbers isn't provided, get data for all. """ if rows: rows = rows else: rows = list(...
[ "def", "save_items", "(", "self", ",", "rows", "=", "None", ",", "verbose", "=", "False", ")", ":", "if", "rows", ":", "rows", "=", "rows", "else", ":", "rows", "=", "list", "(", "range", "(", "self", ".", "GetNumberRows", "(", ")", ")", ")", "co...
Return a dictionary of row data for selected rows: {1: {col1: val1, col2: val2}, ...} If a list of row numbers isn't provided, get data for all.
[ "Return", "a", "dictionary", "of", "row", "data", "for", "selected", "rows", ":", "{", "1", ":", "{", "col1", ":", "val1", "col2", ":", "val2", "}", "...", "}", "If", "a", "list", "of", "row", "numbers", "isn", "t", "provided", "get", "data", "for"...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L194-L213
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.on_edit_grid
def on_edit_grid(self, event): """sets self.changes to true when user edits the grid. provides down and up key functionality for exiting the editor""" if not self.changes: self.changes = {event.Row} else: self.changes.add(event.Row) #self.changes = True ...
python
def on_edit_grid(self, event): """sets self.changes to true when user edits the grid. provides down and up key functionality for exiting the editor""" if not self.changes: self.changes = {event.Row} else: self.changes.add(event.Row) #self.changes = True ...
[ "def", "on_edit_grid", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "changes", ":", "self", ".", "changes", "=", "{", "event", ".", "Row", "}", "else", ":", "self", ".", "changes", ".", "add", "(", "event", ".", "Row", ")", "#se...
sets self.changes to true when user edits the grid. provides down and up key functionality for exiting the editor
[ "sets", "self", ".", "changes", "to", "true", "when", "user", "edits", "the", "grid", ".", "provides", "down", "and", "up", "key", "functionality", "for", "exiting", "the", "editor" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L236-L249
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.do_paste
def do_paste(self, event): """ Read clipboard into dataframe Paste data into grid, adding extra rows if needed and ignoring extra columns. """ # find where the user has clicked col_ind = self.GetGridCursorCol() row_ind = self.GetGridCursorRow() # r...
python
def do_paste(self, event): """ Read clipboard into dataframe Paste data into grid, adding extra rows if needed and ignoring extra columns. """ # find where the user has clicked col_ind = self.GetGridCursorCol() row_ind = self.GetGridCursorRow() # r...
[ "def", "do_paste", "(", "self", ",", "event", ")", ":", "# find where the user has clicked", "col_ind", "=", "self", ".", "GetGridCursorCol", "(", ")", "row_ind", "=", "self", ".", "GetGridCursorRow", "(", ")", "# read in clipboard text", "text_df", "=", "pd", "...
Read clipboard into dataframe Paste data into grid, adding extra rows if needed and ignoring extra columns.
[ "Read", "clipboard", "into", "dataframe", "Paste", "data", "into", "grid", "adding", "extra", "rows", "if", "needed", "and", "ignoring", "extra", "columns", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L281-L317
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.update_changes_after_row_delete
def update_changes_after_row_delete(self, row_num): """ Update self.changes so that row numbers for edited rows are still correct. I.e., if row 4 was edited and then row 2 was deleted, row 4 becomes row 3. This function updates self.changes to reflect that. """ if row_num...
python
def update_changes_after_row_delete(self, row_num): """ Update self.changes so that row numbers for edited rows are still correct. I.e., if row 4 was edited and then row 2 was deleted, row 4 becomes row 3. This function updates self.changes to reflect that. """ if row_num...
[ "def", "update_changes_after_row_delete", "(", "self", ",", "row_num", ")", ":", "if", "row_num", "in", "self", ".", "changes", ".", "copy", "(", ")", ":", "self", ".", "changes", ".", "remove", "(", "row_num", ")", "updated_rows", "=", "[", "]", "for", ...
Update self.changes so that row numbers for edited rows are still correct. I.e., if row 4 was edited and then row 2 was deleted, row 4 becomes row 3. This function updates self.changes to reflect that.
[ "Update", "self", ".", "changes", "so", "that", "row", "numbers", "for", "edited", "rows", "are", "still", "correct", ".", "I", ".", "e", ".", "if", "row", "4", "was", "edited", "and", "then", "row", "2", "was", "deleted", "row", "4", "becomes", "row...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L345-L361
PmagPy/PmagPy
dialogs/magic_grid3.py
BaseMagicGrid.paint_invalid_cell
def paint_invalid_cell(self, row, col, color='MEDIUM VIOLET RED', skip_cell=False): """ Take row, column, and turn it color """ self.SetColLabelRenderer(col, MyColLabelRenderer('#1101e0')) # SetCellRenderer doesn't work with table-based grid (HugeGrid c...
python
def paint_invalid_cell(self, row, col, color='MEDIUM VIOLET RED', skip_cell=False): """ Take row, column, and turn it color """ self.SetColLabelRenderer(col, MyColLabelRenderer('#1101e0')) # SetCellRenderer doesn't work with table-based grid (HugeGrid c...
[ "def", "paint_invalid_cell", "(", "self", ",", "row", ",", "col", ",", "color", "=", "'MEDIUM VIOLET RED'", ",", "skip_cell", "=", "False", ")", ":", "self", ".", "SetColLabelRenderer", "(", "col", ",", "MyColLabelRenderer", "(", "'#1101e0'", ")", ")", "# Se...
Take row, column, and turn it color
[ "Take", "row", "column", "and", "turn", "it", "color" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L443-L451
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeMagicGrid.add_col
def add_col(self, label): """ Update table dataframe, and append a new column Parameters ---------- label : str Returns --------- last_col: int index column number of added col """ self.table.dataframe[label] = '' self...
python
def add_col(self, label): """ Update table dataframe, and append a new column Parameters ---------- label : str Returns --------- last_col: int index column number of added col """ self.table.dataframe[label] = '' self...
[ "def", "add_col", "(", "self", ",", "label", ")", ":", "self", ".", "table", ".", "dataframe", "[", "label", "]", "=", "''", "self", ".", "AppendCols", "(", "1", ",", "updateLabels", "=", "False", ")", "last_col", "=", "self", ".", "table", ".", "G...
Update table dataframe, and append a new column Parameters ---------- label : str Returns --------- last_col: int index column number of added col
[ "Update", "table", "dataframe", "and", "append", "a", "new", "column" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L597-L616
PmagPy/PmagPy
dialogs/magic_grid3.py
HugeMagicGrid.remove_col
def remove_col(self, col_num): """ update table dataframe, and remove a column. resize grid to display correctly """ label_value = self.GetColLabelValue(col_num).strip('**').strip('^^') self.col_labels.remove(label_value) del self.table.dataframe[label_value] ...
python
def remove_col(self, col_num): """ update table dataframe, and remove a column. resize grid to display correctly """ label_value = self.GetColLabelValue(col_num).strip('**').strip('^^') self.col_labels.remove(label_value) del self.table.dataframe[label_value] ...
[ "def", "remove_col", "(", "self", ",", "col_num", ")", ":", "label_value", "=", "self", ".", "GetColLabelValue", "(", "col_num", ")", ".", "strip", "(", "'**'", ")", ".", "strip", "(", "'^^'", ")", "self", ".", "col_labels", ".", "remove", "(", "label_...
update table dataframe, and remove a column. resize grid to display correctly
[ "update", "table", "dataframe", "and", "remove", "a", "column", ".", "resize", "grid", "to", "display", "correctly" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/magic_grid3.py#L619-L629
PmagPy/PmagPy
programs/plotdi_a.py
main
def main(): """ NAME plotdi_a.py DESCRIPTION plots equal area projection from dec inc data and fisher mean, cone of confidence INPUT FORMAT takes dec, inc, alpha95 as first three columns in space delimited file SYNTAX plotdi_a.py [-i][-f FILE] OPTIONS -f ...
python
def main(): """ NAME plotdi_a.py DESCRIPTION plots equal area projection from dec inc data and fisher mean, cone of confidence INPUT FORMAT takes dec, inc, alpha95 as first three columns in space delimited file SYNTAX plotdi_a.py [-i][-f FILE] OPTIONS -f ...
[ "def", "main", "(", ")", ":", "fmt", ",", "plot", "=", "'svg'", ",", "0", "if", "len", "(", "sys", ".", "argv", ")", ">", "0", ":", "if", "'-h'", "in", "sys", ".", "argv", ":", "# check if help is needed", "print", "(", "main", ".", "__doc__", ")...
NAME plotdi_a.py DESCRIPTION plots equal area projection from dec inc data and fisher mean, cone of confidence INPUT FORMAT takes dec, inc, alpha95 as first three columns in space delimited file SYNTAX plotdi_a.py [-i][-f FILE] OPTIONS -f FILE to read file name f...
[ "NAME", "plotdi_a", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/plotdi_a.py#L9-L84
PmagPy/PmagPy
programs/di_rot.py
main
def main(): """ NAME di_rot.py DESCRIPTION rotates set of directions to new coordinate system SYNTAX di_rot.py [command line options] OPTIONS -h prints help message and quits -f specify input file, default is standard input -F specify output file, d...
python
def main(): """ NAME di_rot.py DESCRIPTION rotates set of directions to new coordinate system SYNTAX di_rot.py [command line options] OPTIONS -h prints help message and quits -f specify input file, default is standard input -F specify output file, d...
[ "def", "main", "(", ")", ":", "D", ",", "I", "=", "0.", ",", "90.", "outfile", "=", "\"\"", "infile", "=", "\"\"", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-...
NAME di_rot.py DESCRIPTION rotates set of directions to new coordinate system SYNTAX di_rot.py [command line options] OPTIONS -h prints help message and quits -f specify input file, default is standard input -F specify output file, default is standard outpu...
[ "NAME", "di_rot", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/di_rot.py#L11-L72
PmagPy/PmagPy
programs/conversion_scripts2/_2g_bin_magic2.py
main
def main(command_line=True, **kwargs): """ NAME _2g_bin_magic.py DESCRIPTION takes the binary 2g format magnetometer files and converts them to magic_measurements, er_samples.txt and er_sites.txt file SYNTAX 2g_bin_magic.py [command line options] OPTIONS -f FILE: s...
python
def main(command_line=True, **kwargs): """ NAME _2g_bin_magic.py DESCRIPTION takes the binary 2g format magnetometer files and converts them to magic_measurements, er_samples.txt and er_sites.txt file SYNTAX 2g_bin_magic.py [command line options] OPTIONS -f FILE: s...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "#", "# initialize variables", "#", "mag_file", "=", "''", "specnum", "=", "0", "ub_file", ",", "samp_file", ",", "or_con", ",", "corr", ",", "meas_file", "=", "\"\"", ...
NAME _2g_bin_magic.py DESCRIPTION takes the binary 2g format magnetometer files and converts them to magic_measurements, er_samples.txt and er_sites.txt file SYNTAX 2g_bin_magic.py [command line options] OPTIONS -f FILE: specify input 2g (binary) file -F FILE: spec...
[ "NAME", "_2g_bin_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/_2g_bin_magic2.py#L20-L482
PmagPy/PmagPy
programs/unsquish.py
main
def main(): """ NAME unsquish.py DESCRIPTION takes dec/inc data and "unsquishes" with specified flattening factor, flt using formula tan(If)=(1/flt)*tan(Io) INPUT declination inclination OUTPUT "unsquished" declincation inclination SYNTA...
python
def main(): """ NAME unsquish.py DESCRIPTION takes dec/inc data and "unsquishes" with specified flattening factor, flt using formula tan(If)=(1/flt)*tan(Io) INPUT declination inclination OUTPUT "unsquished" declincation inclination SYNTA...
[ "def", "main", "(", ")", ":", "ofile", "=", "\"\"", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-F'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "ar...
NAME unsquish.py DESCRIPTION takes dec/inc data and "unsquishes" with specified flattening factor, flt using formula tan(If)=(1/flt)*tan(Io) INPUT declination inclination OUTPUT "unsquished" declincation inclination SYNTAX unsquish.py [c...
[ "NAME", "unsquish", ".", "py", "DESCRIPTION", "takes", "dec", "/", "inc", "data", "and", "unsquishes", "with", "specified", "flattening", "factor", "flt", "using", "formula", "tan", "(", "If", ")", "=", "(", "1", "/", "flt", ")", "*", "tan", "(", "Io",...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/unsquish.py#L7-L60
PmagPy/PmagPy
programs/conversion_scripts2/iodp_jr6_magic2.py
main
def main(command_line=True, **kwargs): """ NAME iodp_jr6_magic.py DESCRIPTION converts shipboard .jr6 format files to magic_measurements format files SYNTAX iodp_jr6_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: spe...
python
def main(command_line=True, **kwargs): """ NAME iodp_jr6_magic.py DESCRIPTION converts shipboard .jr6 format files to magic_measurements format files SYNTAX iodp_jr6_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: spe...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "def", "fix_separation", "(", "filename", ",", "new_filename", ")", ":", "old_file", "=", "open", "(", "filename", ",", "'r'", ")", "data", "=", "old_file", ".", "readl...
NAME iodp_jr6_magic.py DESCRIPTION converts shipboard .jr6 format files to magic_measurements format files SYNTAX iodp_jr6_magic.py [command line options] OPTIONS -h: prints the help message and quits. -f FILE: specify input file, or -F FILE: specify outpu...
[ "NAME", "iodp_jr6_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/iodp_jr6_magic2.py#L9-L245
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_n_ptrm
def get_n_ptrm(tmin, tmax, ptrm_temps, ptrm_starting_temps): """ input: tmin, tmax, ptrm_temps, ptrm_starting_temps returns number of ptrm_checks included in best fit segment. excludes checks if temp exceeds tmax OR if starting temp exceeds tmax. output: n_ptrm, ptrm_checks_included_temperatures ...
python
def get_n_ptrm(tmin, tmax, ptrm_temps, ptrm_starting_temps): """ input: tmin, tmax, ptrm_temps, ptrm_starting_temps returns number of ptrm_checks included in best fit segment. excludes checks if temp exceeds tmax OR if starting temp exceeds tmax. output: n_ptrm, ptrm_checks_included_temperatures ...
[ "def", "get_n_ptrm", "(", "tmin", ",", "tmax", ",", "ptrm_temps", ",", "ptrm_starting_temps", ")", ":", "# does not exclude ptrm checks that are less than tmin", "ptrm_checks_included_temps", "=", "[", "]", "for", "num", ",", "check", "in", "enumerate", "(", "ptrm_tem...
input: tmin, tmax, ptrm_temps, ptrm_starting_temps returns number of ptrm_checks included in best fit segment. excludes checks if temp exceeds tmax OR if starting temp exceeds tmax. output: n_ptrm, ptrm_checks_included_temperatures
[ "input", ":", "tmin", "tmax", "ptrm_temps", "ptrm_starting_temps", "returns", "number", "of", "ptrm_checks", "included", "in", "best", "fit", "segment", ".", "excludes", "checks", "if", "temp", "exceeds", "tmax", "OR", "if", "starting", "temp", "exceeds", "tmax"...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L11-L27
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_max_ptrm_check
def get_max_ptrm_check(ptrm_checks_included_temps, ptrm_checks_all_temps, ptrm_x, t_Arai, x_Arai): """ input: ptrm_checks_included_temps, ptrm_checks_all_temps, ptrm_x, t_Arai, x_Arai. sorts through included ptrm_checks and finds the largest ptrm check diff, the sum of the total diffs, and the perce...
python
def get_max_ptrm_check(ptrm_checks_included_temps, ptrm_checks_all_temps, ptrm_x, t_Arai, x_Arai): """ input: ptrm_checks_included_temps, ptrm_checks_all_temps, ptrm_x, t_Arai, x_Arai. sorts through included ptrm_checks and finds the largest ptrm check diff, the sum of the total diffs, and the perce...
[ "def", "get_max_ptrm_check", "(", "ptrm_checks_included_temps", ",", "ptrm_checks_all_temps", ",", "ptrm_x", ",", "t_Arai", ",", "x_Arai", ")", ":", "if", "not", "ptrm_checks_included_temps", ":", "return", "[", "]", ",", "float", "(", "'nan'", ")", ",", "float"...
input: ptrm_checks_included_temps, ptrm_checks_all_temps, ptrm_x, t_Arai, x_Arai. sorts through included ptrm_checks and finds the largest ptrm check diff, the sum of the total diffs, and the percentage of the largest check / original measurement at that temperature step output: max_diff, sum_diffs, che...
[ "input", ":", "ptrm_checks_included_temps", "ptrm_checks_all_temps", "ptrm_x", "t_Arai", "x_Arai", ".", "sorts", "through", "included", "ptrm_checks", "and", "finds", "the", "largest", "ptrm", "check", "diff", "the", "sum", "of", "the", "total", "diffs", "and", "t...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L29-L63
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_DRAT
def get_DRAT(delta_x_prime, delta_y_prime, max_ptrm_check): """ Input: TRM length of best fit line (delta_x_prime), NRM length of best fit line, max_ptrm_check Output: DRAT (maximum difference produced by a ptrm check normed by best fit line), length best fit line """ L = num...
python
def get_DRAT(delta_x_prime, delta_y_prime, max_ptrm_check): """ Input: TRM length of best fit line (delta_x_prime), NRM length of best fit line, max_ptrm_check Output: DRAT (maximum difference produced by a ptrm check normed by best fit line), length best fit line """ L = num...
[ "def", "get_DRAT", "(", "delta_x_prime", ",", "delta_y_prime", ",", "max_ptrm_check", ")", ":", "L", "=", "numpy", ".", "sqrt", "(", "delta_x_prime", "**", "2", "+", "delta_y_prime", "**", "2", ")", "DRAT", "=", "(", "old_div", "(", "max_ptrm_check", ",", ...
Input: TRM length of best fit line (delta_x_prime), NRM length of best fit line, max_ptrm_check Output: DRAT (maximum difference produced by a ptrm check normed by best fit line), length best fit line
[ "Input", ":", "TRM", "length", "of", "best", "fit", "line", "(", "delta_x_prime", ")", "NRM", "length", "of", "best", "fit", "line", "max_ptrm_check", "Output", ":", "DRAT", "(", "maximum", "difference", "produced", "by", "a", "ptrm", "check", "normed", "b...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L73-L83
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_CDRAT
def get_CDRAT(L, sum_ptrm_checks, sum_abs_ptrm_checks): """ input: best_fit line length, sum of ptrm check diffs, sum of absolute value of ptrm check diffs output: CDRAT (uses sum of diffs), CDRAT_prime (uses sum of absolute diffs) """ CDRAT = (old_div(sum_ptrm_checks, L)) * 100. CDRAT_p...
python
def get_CDRAT(L, sum_ptrm_checks, sum_abs_ptrm_checks): """ input: best_fit line length, sum of ptrm check diffs, sum of absolute value of ptrm check diffs output: CDRAT (uses sum of diffs), CDRAT_prime (uses sum of absolute diffs) """ CDRAT = (old_div(sum_ptrm_checks, L)) * 100. CDRAT_p...
[ "def", "get_CDRAT", "(", "L", ",", "sum_ptrm_checks", ",", "sum_abs_ptrm_checks", ")", ":", "CDRAT", "=", "(", "old_div", "(", "sum_ptrm_checks", ",", "L", ")", ")", "*", "100.", "CDRAT_prime", "=", "(", "old_div", "(", "sum_abs_ptrm_checks", ",", "L", ")"...
input: best_fit line length, sum of ptrm check diffs, sum of absolute value of ptrm check diffs output: CDRAT (uses sum of diffs), CDRAT_prime (uses sum of absolute diffs)
[ "input", ":", "best_fit", "line", "length", "sum", "of", "ptrm", "check", "diffs", "sum", "of", "absolute", "value", "of", "ptrm", "check", "diffs", "output", ":", "CDRAT", "(", "uses", "sum", "of", "diffs", ")", "CDRAT_prime", "(", "uses", "sum", "of", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L96-L104
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_DRATS
def get_DRATS(sum_ptrm_checks, sum_abs_ptrm_checks, x_Arai, end): """ input: sum of ptrm check diffs, sum of absolute value of ptrm check diffs, x_Arai set of points, end. output: DRATS (uses sum of diffs), DRATS_prime (uses sum of absolute diffs) """ DRATS = (old_div(sum_ptrm_checks, x_Arai...
python
def get_DRATS(sum_ptrm_checks, sum_abs_ptrm_checks, x_Arai, end): """ input: sum of ptrm check diffs, sum of absolute value of ptrm check diffs, x_Arai set of points, end. output: DRATS (uses sum of diffs), DRATS_prime (uses sum of absolute diffs) """ DRATS = (old_div(sum_ptrm_checks, x_Arai...
[ "def", "get_DRATS", "(", "sum_ptrm_checks", ",", "sum_abs_ptrm_checks", ",", "x_Arai", ",", "end", ")", ":", "DRATS", "=", "(", "old_div", "(", "sum_ptrm_checks", ",", "x_Arai", "[", "end", "]", ")", ")", "*", "100.", "DRATS_prime", "=", "(", "old_div", ...
input: sum of ptrm check diffs, sum of absolute value of ptrm check diffs, x_Arai set of points, end. output: DRATS (uses sum of diffs), DRATS_prime (uses sum of absolute diffs)
[ "input", ":", "sum", "of", "ptrm", "check", "diffs", "sum", "of", "absolute", "value", "of", "ptrm", "check", "diffs", "x_Arai", "set", "of", "points", "end", ".", "output", ":", "DRATS", "(", "uses", "sum", "of", "diffs", ")", "DRATS_prime", "(", "use...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L106-L114
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_mean_DRAT
def get_mean_DRAT(sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, L): """ input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, L output: mean DRAT (the average difference produced by a pTRM check, normalized by the length of the best-fit line) """ if not n_pTRM: return float('nan'), float(...
python
def get_mean_DRAT(sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, L): """ input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, L output: mean DRAT (the average difference produced by a pTRM check, normalized by the length of the best-fit line) """ if not n_pTRM: return float('nan'), float(...
[ "def", "get_mean_DRAT", "(", "sum_ptrm_checks", ",", "sum_abs_ptrm_checks", ",", "n_pTRM", ",", "L", ")", ":", "if", "not", "n_pTRM", ":", "return", "float", "(", "'nan'", ")", ",", "float", "(", "'nan'", ")", "mean_DRAT", "=", "(", "(", "old_div", "(", ...
input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, L output: mean DRAT (the average difference produced by a pTRM check, normalized by the length of the best-fit line)
[ "input", ":", "sum_ptrm_checks", "sum_abs_ptrm_checks", "n_pTRM", "L", "output", ":", "mean", "DRAT", "(", "the", "average", "difference", "produced", "by", "a", "pTRM", "check", "normalized", "by", "the", "length", "of", "the", "best", "-", "fit", "line", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L116-L126
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_mean_DEV
def get_mean_DEV(sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, delta_x_prime): """ input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, delta_x_prime output: Mean deviation of a pTRM check """ if not n_pTRM: return float('nan'), float('nan') mean_DEV = ((old_div(1., n_pTRM)) * (old_div(s...
python
def get_mean_DEV(sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, delta_x_prime): """ input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, delta_x_prime output: Mean deviation of a pTRM check """ if not n_pTRM: return float('nan'), float('nan') mean_DEV = ((old_div(1., n_pTRM)) * (old_div(s...
[ "def", "get_mean_DEV", "(", "sum_ptrm_checks", ",", "sum_abs_ptrm_checks", ",", "n_pTRM", ",", "delta_x_prime", ")", ":", "if", "not", "n_pTRM", ":", "return", "float", "(", "'nan'", ")", ",", "float", "(", "'nan'", ")", "mean_DEV", "=", "(", "(", "old_div...
input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, delta_x_prime output: Mean deviation of a pTRM check
[ "input", ":", "sum_ptrm_checks", "sum_abs_ptrm_checks", "n_pTRM", "delta_x_prime", "output", ":", "Mean", "deviation", "of", "a", "pTRM", "check" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L128-L137
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_delta_pal_vectors
def get_delta_pal_vectors(PTRMS, PTRM_Checks, NRM): """ takes in PTRM data in this format: [temp, dec, inc, moment, ZI or IZ] -- and PTRM_check data in this format: [temp, dec, inc, moment]. Returns them in vector form (cartesian). """ PTRMS = numpy.array(PTRMS) PTRM_Checks = numpy.array(PTRM_Checks) T...
python
def get_delta_pal_vectors(PTRMS, PTRM_Checks, NRM): """ takes in PTRM data in this format: [temp, dec, inc, moment, ZI or IZ] -- and PTRM_check data in this format: [temp, dec, inc, moment]. Returns them in vector form (cartesian). """ PTRMS = numpy.array(PTRMS) PTRM_Checks = numpy.array(PTRM_Checks) T...
[ "def", "get_delta_pal_vectors", "(", "PTRMS", ",", "PTRM_Checks", ",", "NRM", ")", ":", "PTRMS", "=", "numpy", ".", "array", "(", "PTRMS", ")", "PTRM_Checks", "=", "numpy", ".", "array", "(", "PTRM_Checks", ")", "TRM_1", "=", "lib_direct", ".", "dir2cart",...
takes in PTRM data in this format: [temp, dec, inc, moment, ZI or IZ] -- and PTRM_check data in this format: [temp, dec, inc, moment]. Returns them in vector form (cartesian).
[ "takes", "in", "PTRM", "data", "in", "this", "format", ":", "[", "temp", "dec", "inc", "moment", "ZI", "or", "IZ", "]", "--", "and", "PTRM_check", "data", "in", "this", "format", ":", "[", "temp", "dec", "inc", "moment", "]", ".", "Returns", "them", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L139-L152
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_diffs
def get_diffs(ptrms_vectors, ptrm_checks_vectors, ptrms_orig, checks_orig): """ input: ptrms_vectors, ptrm_checks_vectors, ptrms_orig, checks_orig output: vector diffs between original and ptrm check, C """ ptrm_temps = numpy.array(ptrms_orig)[:,0] check_temps = numpy.array(checks_orig)[:,0] ...
python
def get_diffs(ptrms_vectors, ptrm_checks_vectors, ptrms_orig, checks_orig): """ input: ptrms_vectors, ptrm_checks_vectors, ptrms_orig, checks_orig output: vector diffs between original and ptrm check, C """ ptrm_temps = numpy.array(ptrms_orig)[:,0] check_temps = numpy.array(checks_orig)[:,0] ...
[ "def", "get_diffs", "(", "ptrms_vectors", ",", "ptrm_checks_vectors", ",", "ptrms_orig", ",", "checks_orig", ")", ":", "ptrm_temps", "=", "numpy", ".", "array", "(", "ptrms_orig", ")", "[", ":", ",", "0", "]", "check_temps", "=", "numpy", ".", "array", "("...
input: ptrms_vectors, ptrm_checks_vectors, ptrms_orig, checks_orig output: vector diffs between original and ptrm check, C
[ "input", ":", "ptrms_vectors", "ptrm_checks_vectors", "ptrms_orig", "checks_orig", "output", ":", "vector", "diffs", "between", "original", "and", "ptrm", "check", "C" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L154-L178
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_TRM_star
def get_TRM_star(C, ptrms_vectors, start, end): """ input: C, ptrms_vectors, start, end output: TRM_star, x_star (for delta_pal statistic) """ TRM_star = numpy.zeros([len(ptrms_vectors), 3]) TRM_star[0] = [0., 0., 0.] x_star = numpy.zeros(len(ptrms_vectors)) for num, vec in enumerate(ptr...
python
def get_TRM_star(C, ptrms_vectors, start, end): """ input: C, ptrms_vectors, start, end output: TRM_star, x_star (for delta_pal statistic) """ TRM_star = numpy.zeros([len(ptrms_vectors), 3]) TRM_star[0] = [0., 0., 0.] x_star = numpy.zeros(len(ptrms_vectors)) for num, vec in enumerate(ptr...
[ "def", "get_TRM_star", "(", "C", ",", "ptrms_vectors", ",", "start", ",", "end", ")", ":", "TRM_star", "=", "numpy", ".", "zeros", "(", "[", "len", "(", "ptrms_vectors", ")", ",", "3", "]", ")", "TRM_star", "[", "0", "]", "=", "[", "0.", ",", "0....
input: C, ptrms_vectors, start, end output: TRM_star, x_star (for delta_pal statistic)
[ "input", ":", "C", "ptrms_vectors", "start", "end", "output", ":", "TRM_star", "x_star", "(", "for", "delta_pal", "statistic", ")" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L180-L196
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_b_star
def get_b_star(x_star, y_err, y_mean, y_segment): """ input: x_star, y_err, y_mean, y_segment output: b_star (corrected slope for delta_pal statistic) """ #print "x_star, should be same as Xcorr / NRM" #print x_star x_star_mean = numpy.mean(x_star) x_err = x_star - x_star_mean b_star...
python
def get_b_star(x_star, y_err, y_mean, y_segment): """ input: x_star, y_err, y_mean, y_segment output: b_star (corrected slope for delta_pal statistic) """ #print "x_star, should be same as Xcorr / NRM" #print x_star x_star_mean = numpy.mean(x_star) x_err = x_star - x_star_mean b_star...
[ "def", "get_b_star", "(", "x_star", ",", "y_err", ",", "y_mean", ",", "y_segment", ")", ":", "#print \"x_star, should be same as Xcorr / NRM\"", "#print x_star", "x_star_mean", "=", "numpy", ".", "mean", "(", "x_star", ")", "x_err", "=", "x_star", "-", "x_star_mea...
input: x_star, y_err, y_mean, y_segment output: b_star (corrected slope for delta_pal statistic)
[ "input", ":", "x_star", "y_err", "y_mean", "y_segment", "output", ":", "b_star", "(", "corrected", "slope", "for", "delta_pal", "statistic", ")" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L198-L212
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_delta_pal
def get_delta_pal(b, b_star): """ input: b, b_star (actual and corrected slope) output: delta_pal """ delta_pal = numpy.abs(old_div((b - b_star), b)) * 100 return delta_pal
python
def get_delta_pal(b, b_star): """ input: b, b_star (actual and corrected slope) output: delta_pal """ delta_pal = numpy.abs(old_div((b - b_star), b)) * 100 return delta_pal
[ "def", "get_delta_pal", "(", "b", ",", "b_star", ")", ":", "delta_pal", "=", "numpy", ".", "abs", "(", "old_div", "(", "(", "b", "-", "b_star", ")", ",", "b", ")", ")", "*", "100", "return", "delta_pal" ]
input: b, b_star (actual and corrected slope) output: delta_pal
[ "input", ":", "b", "b_star", "(", "actual", "and", "corrected", "slope", ")", "output", ":", "delta_pal" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L215-L221
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_full_delta_pal
def get_full_delta_pal(PTRMS, PTRM_Checks, NRM, y_err, y_mean, b, start, end, y_segment): """ input: PTRMS, PTRM_Checks, NRM, y_err, y_mean, b, start, end, y_segment runs full sequence necessary to get delta_pal """ #print "-------" #print "calling get_full_delta_pal in lib" # return 0 PT...
python
def get_full_delta_pal(PTRMS, PTRM_Checks, NRM, y_err, y_mean, b, start, end, y_segment): """ input: PTRMS, PTRM_Checks, NRM, y_err, y_mean, b, start, end, y_segment runs full sequence necessary to get delta_pal """ #print "-------" #print "calling get_full_delta_pal in lib" # return 0 PT...
[ "def", "get_full_delta_pal", "(", "PTRMS", ",", "PTRM_Checks", ",", "NRM", ",", "y_err", ",", "y_mean", ",", "b", ",", "start", ",", "end", ",", "y_segment", ")", ":", "#print \"-------\"", "#print \"calling get_full_delta_pal in lib\"", "# return 0", "PTRMS_cart...
input: PTRMS, PTRM_Checks, NRM, y_err, y_mean, b, start, end, y_segment runs full sequence necessary to get delta_pal
[ "input", ":", "PTRMS", "PTRM_Checks", "NRM", "y_err", "y_mean", "b", "start", "end", "y_segment", "runs", "full", "sequence", "necessary", "to", "get", "delta_pal" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L224-L241
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_segments
def get_segments(ptrms, ptrm_checks, tmax): """ input: ptrms, ptrm_checks, tmax grabs ptrms that are done below tmax grabs ptrm checks that are done below tmax AND whose starting temp is below tmax output: ptrms_included, checks_included """ ptrms_included = [] checks_included = [] p...
python
def get_segments(ptrms, ptrm_checks, tmax): """ input: ptrms, ptrm_checks, tmax grabs ptrms that are done below tmax grabs ptrm checks that are done below tmax AND whose starting temp is below tmax output: ptrms_included, checks_included """ ptrms_included = [] checks_included = [] p...
[ "def", "get_segments", "(", "ptrms", ",", "ptrm_checks", ",", "tmax", ")", ":", "ptrms_included", "=", "[", "]", "checks_included", "=", "[", "]", "ptrms", "=", "numpy", ".", "array", "(", "ptrms", ")", "for", "ptrm", "in", "ptrms", ":", "if", "ptrm", ...
input: ptrms, ptrm_checks, tmax grabs ptrms that are done below tmax grabs ptrm checks that are done below tmax AND whose starting temp is below tmax output: ptrms_included, checks_included
[ "input", ":", "ptrms", "ptrm_checks", "tmax", "grabs", "ptrms", "that", "are", "done", "below", "tmax", "grabs", "ptrm", "checks", "that", "are", "done", "below", "tmax", "AND", "whose", "starting", "temp", "is", "below", "tmax", "output", ":", "ptrms_includ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L243-L261
PmagPy/PmagPy
pmagpy/Fit.py
Fit.select
def select(self): """ Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon) """ if self.GUI==None: return self.GUI.current_fit = self if self.tmax != None and self.tmin != None: self.GUI.update_bounds_boxes()...
python
def select(self): """ Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon) """ if self.GUI==None: return self.GUI.current_fit = self if self.tmax != None and self.tmin != None: self.GUI.update_bounds_boxes()...
[ "def", "select", "(", "self", ")", ":", "if", "self", ".", "GUI", "==", "None", ":", "return", "self", ".", "GUI", ".", "current_fit", "=", "self", "if", "self", ".", "tmax", "!=", "None", "and", "self", ".", "tmin", "!=", "None", ":", "self", "....
Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon)
[ "Makes", "this", "fit", "the", "selected", "fit", "on", "the", "GUI", "that", "is", "it", "s", "parent", "(", "Note", ":", "may", "be", "moved", "into", "GUI", "soon", ")" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/Fit.py#L58-L72
PmagPy/PmagPy
pmagpy/Fit.py
Fit.get
def get(self,coordinate_system): """ Return the pmagpy paramters dictionary associated with this fit and the given coordinate system @param: coordinate_system -> the coordinate system who's parameters to return """ if coordinate_system == 'DA-DIR' or coordinate_system == ...
python
def get(self,coordinate_system): """ Return the pmagpy paramters dictionary associated with this fit and the given coordinate system @param: coordinate_system -> the coordinate system who's parameters to return """ if coordinate_system == 'DA-DIR' or coordinate_system == ...
[ "def", "get", "(", "self", ",", "coordinate_system", ")", ":", "if", "coordinate_system", "==", "'DA-DIR'", "or", "coordinate_system", "==", "'specimen'", ":", "return", "self", ".", "pars", "elif", "coordinate_system", "==", "'DA-DIR-GEO'", "or", "coordinate_syst...
Return the pmagpy paramters dictionary associated with this fit and the given coordinate system @param: coordinate_system -> the coordinate system who's parameters to return
[ "Return", "the", "pmagpy", "paramters", "dictionary", "associated", "with", "this", "fit", "and", "the", "given", "coordinate", "system" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/Fit.py#L74-L88
PmagPy/PmagPy
pmagpy/Fit.py
Fit.put
def put(self,specimen,coordinate_system,new_pars): """ Given a coordinate system and a new parameters dictionary that follows pmagpy convention given by the pmag.py/domean function it alters this fit's bounds and parameters such that it matches the new data. @param: specimen -> N...
python
def put(self,specimen,coordinate_system,new_pars): """ Given a coordinate system and a new parameters dictionary that follows pmagpy convention given by the pmag.py/domean function it alters this fit's bounds and parameters such that it matches the new data. @param: specimen -> N...
[ "def", "put", "(", "self", ",", "specimen", ",", "coordinate_system", ",", "new_pars", ")", ":", "if", "specimen", "!=", "None", ":", "if", "type", "(", "new_pars", ")", "==", "dict", ":", "if", "'er_specimen_name'", "not", "in", "list", "(", "new_pars",...
Given a coordinate system and a new parameters dictionary that follows pmagpy convention given by the pmag.py/domean function it alters this fit's bounds and parameters such that it matches the new data. @param: specimen -> None if fit is for a site or a sample or a valid specimen from self.GUI ...
[ "Given", "a", "coordinate", "system", "and", "a", "new", "parameters", "dictionary", "that", "follows", "pmagpy", "convention", "given", "by", "the", "pmag", ".", "py", "/", "domean", "function", "it", "alters", "this", "fit", "s", "bounds", "and", "paramete...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/Fit.py#L90-L146
PmagPy/PmagPy
pmagpy/Fit.py
Fit.has_values
def has_values(self, name, tmin, tmax): """ A basic fit equality checker compares name and bounds of 2 fits @param: name -> name of the other fit @param: tmin -> lower bound of the other fit @param: tmax -> upper bound of the other fit @return: boolean comaparing 2 fits ...
python
def has_values(self, name, tmin, tmax): """ A basic fit equality checker compares name and bounds of 2 fits @param: name -> name of the other fit @param: tmin -> lower bound of the other fit @param: tmax -> upper bound of the other fit @return: boolean comaparing 2 fits ...
[ "def", "has_values", "(", "self", ",", "name", ",", "tmin", ",", "tmax", ")", ":", "return", "str", "(", "self", ".", "name", ")", "==", "str", "(", "name", ")", "and", "str", "(", "self", ".", "tmin", ")", "==", "str", "(", "tmin", ")", "and",...
A basic fit equality checker compares name and bounds of 2 fits @param: name -> name of the other fit @param: tmin -> lower bound of the other fit @param: tmax -> upper bound of the other fit @return: boolean comaparing 2 fits
[ "A", "basic", "fit", "equality", "checker", "compares", "name", "and", "bounds", "of", "2", "fits" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/Fit.py#L160-L168
PmagPy/PmagPy
SPD/lib/lib_tail_check_statistics.py
get_n_tail
def get_n_tail(tmax, tail_temps): """determines number of included tail checks in best fit segment""" #print "tail_temps: {0}, tmax: {0}".format(tail_temps, tmax) t_index = 0 adj_tmax = 0 if tmax < tail_temps[0]: return 0 try: t_index = list(tail_temps).index(tmax) except: # ...
python
def get_n_tail(tmax, tail_temps): """determines number of included tail checks in best fit segment""" #print "tail_temps: {0}, tmax: {0}".format(tail_temps, tmax) t_index = 0 adj_tmax = 0 if tmax < tail_temps[0]: return 0 try: t_index = list(tail_temps).index(tmax) except: # ...
[ "def", "get_n_tail", "(", "tmax", ",", "tail_temps", ")", ":", "#print \"tail_temps: {0}, tmax: {0}\".format(tail_temps, tmax)", "t_index", "=", "0", "adj_tmax", "=", "0", "if", "tmax", "<", "tail_temps", "[", "0", "]", ":", "return", "0", "try", ":", "t_index",...
determines number of included tail checks in best fit segment
[ "determines", "number", "of", "included", "tail", "checks", "in", "best", "fit", "segment" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_tail_check_statistics.py#L7-L22
PmagPy/PmagPy
SPD/lib/lib_tail_check_statistics.py
get_max_tail_check
def get_max_tail_check(y_Arai, y_tail, t_Arai, tail_temps, n_tail): """ input: y_Arai, y_tail, t_Arai, tail_temps, n_tail output: max_check, diffs """ if not n_tail: return float('nan'), [] tail_compare = [] y_Arai_compare = [] for temp in tail_temps[:n_tail]: tail_index ...
python
def get_max_tail_check(y_Arai, y_tail, t_Arai, tail_temps, n_tail): """ input: y_Arai, y_tail, t_Arai, tail_temps, n_tail output: max_check, diffs """ if not n_tail: return float('nan'), [] tail_compare = [] y_Arai_compare = [] for temp in tail_temps[:n_tail]: tail_index ...
[ "def", "get_max_tail_check", "(", "y_Arai", ",", "y_tail", ",", "t_Arai", ",", "tail_temps", ",", "n_tail", ")", ":", "if", "not", "n_tail", ":", "return", "float", "(", "'nan'", ")", ",", "[", "]", "tail_compare", "=", "[", "]", "y_Arai_compare", "=", ...
input: y_Arai, y_tail, t_Arai, tail_temps, n_tail output: max_check, diffs
[ "input", ":", "y_Arai", "y_tail", "t_Arai", "tail_temps", "n_tail", "output", ":", "max_check", "diffs" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_tail_check_statistics.py#L25-L44
PmagPy/PmagPy
SPD/lib/lib_tail_check_statistics.py
get_DRAT_tail
def get_DRAT_tail(max_check, L): """ input: tail_check_max, best fit line length output: DRAT_tail """ if max_check == 0: return float('nan') DRAT_tail = (old_div(max_check, L)) * 100. return DRAT_tail
python
def get_DRAT_tail(max_check, L): """ input: tail_check_max, best fit line length output: DRAT_tail """ if max_check == 0: return float('nan') DRAT_tail = (old_div(max_check, L)) * 100. return DRAT_tail
[ "def", "get_DRAT_tail", "(", "max_check", ",", "L", ")", ":", "if", "max_check", "==", "0", ":", "return", "float", "(", "'nan'", ")", "DRAT_tail", "=", "(", "old_div", "(", "max_check", ",", "L", ")", ")", "*", "100.", "return", "DRAT_tail" ]
input: tail_check_max, best fit line length output: DRAT_tail
[ "input", ":", "tail_check_max", "best", "fit", "line", "length", "output", ":", "DRAT_tail" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_tail_check_statistics.py#L47-L55
PmagPy/PmagPy
SPD/lib/lib_tail_check_statistics.py
get_delta_TR
def get_delta_TR(tail_check_max, y_int): """ input: tail_check_max, y_intercept output: delta_TR """ if tail_check_max == 0 or numpy.isnan(tail_check_max): return float('nan') delta_TR = (old_div(tail_check_max, abs(y_int))) * 100. return delta_TR
python
def get_delta_TR(tail_check_max, y_int): """ input: tail_check_max, y_intercept output: delta_TR """ if tail_check_max == 0 or numpy.isnan(tail_check_max): return float('nan') delta_TR = (old_div(tail_check_max, abs(y_int))) * 100. return delta_TR
[ "def", "get_delta_TR", "(", "tail_check_max", ",", "y_int", ")", ":", "if", "tail_check_max", "==", "0", "or", "numpy", ".", "isnan", "(", "tail_check_max", ")", ":", "return", "float", "(", "'nan'", ")", "delta_TR", "=", "(", "old_div", "(", "tail_check_m...
input: tail_check_max, y_intercept output: delta_TR
[ "input", ":", "tail_check_max", "y_intercept", "output", ":", "delta_TR" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_tail_check_statistics.py#L58-L66
PmagPy/PmagPy
SPD/lib/lib_tail_check_statistics.py
get_MD_VDS
def get_MD_VDS(tail_check_max, vds): """ input: tail_check_max, vector difference sum output: MD_VDS """ if tail_check_max == 0 or numpy.isnan(tail_check_max): return float('nan') MD_VDS = (old_div(tail_check_max, vds)) * 100 return MD_VDS
python
def get_MD_VDS(tail_check_max, vds): """ input: tail_check_max, vector difference sum output: MD_VDS """ if tail_check_max == 0 or numpy.isnan(tail_check_max): return float('nan') MD_VDS = (old_div(tail_check_max, vds)) * 100 return MD_VDS
[ "def", "get_MD_VDS", "(", "tail_check_max", ",", "vds", ")", ":", "if", "tail_check_max", "==", "0", "or", "numpy", ".", "isnan", "(", "tail_check_max", ")", ":", "return", "float", "(", "'nan'", ")", "MD_VDS", "=", "(", "old_div", "(", "tail_check_max", ...
input: tail_check_max, vector difference sum output: MD_VDS
[ "input", ":", "tail_check_max", "vector", "difference", "sum", "output", ":", "MD_VDS" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_tail_check_statistics.py#L69-L77
PmagPy/PmagPy
programs/dir_redo.py
main
def main(): """ NAME dir_redo.py DESCRIPTION converts the Cogne DIR format to PmagPy redo file SYNTAX dir_redo.py [-h] [command line options] OPTIONS -h: prints help message and quits -f FILE: specify input file -F FILE: specify output file, defaul...
python
def main(): """ NAME dir_redo.py DESCRIPTION converts the Cogne DIR format to PmagPy redo file SYNTAX dir_redo.py [-h] [command line options] OPTIONS -h: prints help message and quits -f FILE: specify input file -F FILE: specify output file, defaul...
[ "def", "main", "(", ")", ":", "dir_path", "=", "'.'", "zfile", "=", "'zeq_redo'", "if", "'-WD'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "argv", ".", "index", "(", "'-WD'", ")", "dir_path", "=", "sys", ".", "argv", "[", "ind", "+",...
NAME dir_redo.py DESCRIPTION converts the Cogne DIR format to PmagPy redo file SYNTAX dir_redo.py [-h] [command line options] OPTIONS -h: prints help message and quits -f FILE: specify input file -F FILE: specify output file, default is 'zeq_redo'
[ "NAME", "dir_redo", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/dir_redo.py#L5-L76
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.set_dm
def set_dm(self, num): """ Make GUI changes based on data model num. Get info from WD in appropriate format. """ #enable or disable self.btn1a if self.data_model_num == 3: self.btn1a.Enable() else: self.btn1a.Disable() # # s...
python
def set_dm(self, num): """ Make GUI changes based on data model num. Get info from WD in appropriate format. """ #enable or disable self.btn1a if self.data_model_num == 3: self.btn1a.Enable() else: self.btn1a.Disable() # # s...
[ "def", "set_dm", "(", "self", ",", "num", ")", ":", "#enable or disable self.btn1a", "if", "self", ".", "data_model_num", "==", "3", ":", "self", ".", "btn1a", ".", "Enable", "(", ")", "else", ":", "self", ".", "btn1a", ".", "Disable", "(", ")", "#", ...
Make GUI changes based on data model num. Get info from WD in appropriate format.
[ "Make", "GUI", "changes", "based", "on", "data", "model", "num", ".", "Get", "info", "from", "WD", "in", "appropriate", "format", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L105-L128
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.get_wd_data
def get_wd_data(self): """ Show dialog to get user input for which directory to set as working directory. Called by self.get_dm_and_wd """ wait = wx.BusyInfo('Reading in data from current working directory, please wait...') #wx.Yield() print('-I- Read in a...
python
def get_wd_data(self): """ Show dialog to get user input for which directory to set as working directory. Called by self.get_dm_and_wd """ wait = wx.BusyInfo('Reading in data from current working directory, please wait...') #wx.Yield() print('-I- Read in a...
[ "def", "get_wd_data", "(", "self", ")", ":", "wait", "=", "wx", ".", "BusyInfo", "(", "'Reading in data from current working directory, please wait...'", ")", "#wx.Yield()", "print", "(", "'-I- Read in any available data from working directory'", ")", "self", ".", "contribu...
Show dialog to get user input for which directory to set as working directory. Called by self.get_dm_and_wd
[ "Show", "dialog", "to", "get", "user", "input", "for", "which", "directory", "to", "set", "as", "working", "directory", ".", "Called", "by", "self", ".", "get_dm_and_wd" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L130-L140
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.get_wd_data2
def get_wd_data2(self): """ Get 2.5 data from self.WD and put it into ErMagicBuilder object. Called by get_dm_and_wd """ wait = wx.BusyInfo('Reading in data from current working directory, please wait...') #wx.Yield() print('-I- Read in any available data ...
python
def get_wd_data2(self): """ Get 2.5 data from self.WD and put it into ErMagicBuilder object. Called by get_dm_and_wd """ wait = wx.BusyInfo('Reading in data from current working directory, please wait...') #wx.Yield() print('-I- Read in any available data ...
[ "def", "get_wd_data2", "(", "self", ")", ":", "wait", "=", "wx", ".", "BusyInfo", "(", "'Reading in data from current working directory, please wait...'", ")", "#wx.Yield()", "print", "(", "'-I- Read in any available data from working directory (data model 2)'", ")", "self", ...
Get 2.5 data from self.WD and put it into ErMagicBuilder object. Called by get_dm_and_wd
[ "Get", "2", ".", "5", "data", "from", "self", ".", "WD", "and", "put", "it", "into", "ErMagicBuilder", "object", ".", "Called", "by", "get_dm_and_wd" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L142-L154
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.InitUI
def InitUI(self): """ Build the mainframe """ menubar = pmag_gui_menu.MagICMenu(self, data_model_num=self.data_model_num) self.SetMenuBar(menubar) #pnl = self.panel #---sizer logo ---- #start_image = wx.Image("/Users/ronshaar/PmagPy/images/logo2.png") ...
python
def InitUI(self): """ Build the mainframe """ menubar = pmag_gui_menu.MagICMenu(self, data_model_num=self.data_model_num) self.SetMenuBar(menubar) #pnl = self.panel #---sizer logo ---- #start_image = wx.Image("/Users/ronshaar/PmagPy/images/logo2.png") ...
[ "def", "InitUI", "(", "self", ")", ":", "menubar", "=", "pmag_gui_menu", ".", "MagICMenu", "(", "self", ",", "data_model_num", "=", "self", ".", "data_model_num", ")", "self", ".", "SetMenuBar", "(", "menubar", ")", "#pnl = self.panel", "#---sizer logo ----", ...
Build the mainframe
[ "Build", "the", "mainframe" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L156-L333
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.get_dir
def get_dir(self): """ Choose a working directory dialog. Called by self.get_dm_and_wd. """ if "-WD" in sys.argv and self.FIRST_RUN: ind = sys.argv.index('-WD') self.WD = os.path.abspath(sys.argv[ind+1]) os.chdir(self.WD) self.WD = ...
python
def get_dir(self): """ Choose a working directory dialog. Called by self.get_dm_and_wd. """ if "-WD" in sys.argv and self.FIRST_RUN: ind = sys.argv.index('-WD') self.WD = os.path.abspath(sys.argv[ind+1]) os.chdir(self.WD) self.WD = ...
[ "def", "get_dir", "(", "self", ")", ":", "if", "\"-WD\"", "in", "sys", ".", "argv", "and", "self", ".", "FIRST_RUN", ":", "ind", "=", "sys", ".", "argv", ".", "index", "(", "'-WD'", ")", "self", ".", "WD", "=", "os", ".", "path", ".", "abspath", ...
Choose a working directory dialog. Called by self.get_dm_and_wd.
[ "Choose", "a", "working", "directory", "dialog", ".", "Called", "by", "self", ".", "get_dm_and_wd", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L337-L352
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_thellier_gui
def on_btn_thellier_gui(self, event): """ Open Thellier GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "thellier_gui.py -WD %s"%self.WD print("-I- running python script:\n %s"%...
python
def on_btn_thellier_gui(self, event): """ Open Thellier GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "thellier_gui.py -WD %s"%self.WD print("-I- running python script:\n %s"%...
[ "def", "on_btn_thellier_gui", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "check_for_meas_file", "(", ")", ":", "return", "if", "not", "self", ".", "check_for_uncombined_files", "(", ")", ":", "return", "outstring", "=", "\"thellier_gui.py -...
Open Thellier GUI
[ "Open", "Thellier", "GUI" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L441-L471
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_demag_gui
def on_btn_demag_gui(self, event): """ Open Demag GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "demag_gui.py -WD %s"%self.WD print("-I- running python script:\n %s"%(outstri...
python
def on_btn_demag_gui(self, event): """ Open Demag GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "demag_gui.py -WD %s"%self.WD print("-I- running python script:\n %s"%(outstri...
[ "def", "on_btn_demag_gui", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "check_for_meas_file", "(", ")", ":", "return", "if", "not", "self", ".", "check_for_uncombined_files", "(", ")", ":", "return", "outstring", "=", "\"demag_gui.py -WD %s\...
Open Demag GUI
[ "Open", "Demag", "GUI" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L474-L504
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_convert_3
def on_btn_convert_3(self, event): """ Open dialog for rough conversion of 2.5 files to 3.0 files. Offer link to earthref for proper upgrade. """ dia = pw.UpgradeDialog(None) dia.Center() res = dia.ShowModal() if res == wx.ID_CANCEL: we...
python
def on_btn_convert_3(self, event): """ Open dialog for rough conversion of 2.5 files to 3.0 files. Offer link to earthref for proper upgrade. """ dia = pw.UpgradeDialog(None) dia.Center() res = dia.ShowModal() if res == wx.ID_CANCEL: we...
[ "def", "on_btn_convert_3", "(", "self", ",", "event", ")", ":", "dia", "=", "pw", ".", "UpgradeDialog", "(", "None", ")", "dia", ".", "Center", "(", ")", "res", "=", "dia", ".", "ShowModal", "(", ")", "if", "res", "==", "wx", ".", "ID_CANCEL", ":",...
Open dialog for rough conversion of 2.5 files to 3.0 files. Offer link to earthref for proper upgrade.
[ "Open", "dialog", "for", "rough", "conversion", "of", "2", ".", "5", "files", "to", "3", ".", "0", "files", ".", "Offer", "link", "to", "earthref", "for", "proper", "upgrade", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L528-L571
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_metadata
def on_btn_metadata(self, event): """ Initiate the series of windows to add metadata to the contribution. """ # make sure we have a measurements file if not self.check_for_meas_file(): return # make sure all files of the same type have been combined ...
python
def on_btn_metadata(self, event): """ Initiate the series of windows to add metadata to the contribution. """ # make sure we have a measurements file if not self.check_for_meas_file(): return # make sure all files of the same type have been combined ...
[ "def", "on_btn_metadata", "(", "self", ",", "event", ")", ":", "# make sure we have a measurements file", "if", "not", "self", ".", "check_for_meas_file", "(", ")", ":", "return", "# make sure all files of the same type have been combined", "if", "not", "self", ".", "ch...
Initiate the series of windows to add metadata to the contribution.
[ "Initiate", "the", "series", "of", "windows", "to", "add", "metadata", "to", "the", "contribution", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L574-L600
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.init_check_window2
def init_check_window2(self): """ initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc. """ self.check_dia = pmag_er_magic_dialogs.ErMagicCheckFrame(self, 'Check Data', s...
python
def init_check_window2(self): """ initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc. """ self.check_dia = pmag_er_magic_dialogs.ErMagicCheckFrame(self, 'Check Data', s...
[ "def", "init_check_window2", "(", "self", ")", ":", "self", ".", "check_dia", "=", "pmag_er_magic_dialogs", ".", "ErMagicCheckFrame", "(", "self", ",", "'Check Data'", ",", "self", ".", "WD", ",", "self", ".", "er_magic", ")" ]
initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc.
[ "initiates", "the", "object", "that", "will", "control", "steps", "1", "-", "6", "of", "checking", "headers", "filling", "in", "cell", "values", "etc", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L602-L608
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.init_check_window
def init_check_window(self): """ initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc. """ self.check_dia = pmag_er_magic_dialogs.ErMagicCheckFrame3(self, 'Check Data', ...
python
def init_check_window(self): """ initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc. """ self.check_dia = pmag_er_magic_dialogs.ErMagicCheckFrame3(self, 'Check Data', ...
[ "def", "init_check_window", "(", "self", ")", ":", "self", ".", "check_dia", "=", "pmag_er_magic_dialogs", ".", "ErMagicCheckFrame3", "(", "self", ",", "'Check Data'", ",", "self", ".", "WD", ",", "self", ".", "contribution", ")" ]
initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc.
[ "initiates", "the", "object", "that", "will", "control", "steps", "1", "-", "6", "of", "checking", "headers", "filling", "in", "cell", "values", "etc", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L610-L616
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_orientation
def on_btn_orientation(self, event): """ Create and fill wxPython grid for entering orientation data. """ wait = wx.BusyInfo('Compiling required data, please wait...') wx.SafeYield() #dw, dh = wx.DisplaySize() size = wx.DisplaySize() size = (size[0...
python
def on_btn_orientation(self, event): """ Create and fill wxPython grid for entering orientation data. """ wait = wx.BusyInfo('Compiling required data, please wait...') wx.SafeYield() #dw, dh = wx.DisplaySize() size = wx.DisplaySize() size = (size[0...
[ "def", "on_btn_orientation", "(", "self", ",", "event", ")", ":", "wait", "=", "wx", ".", "BusyInfo", "(", "'Compiling required data, please wait...'", ")", "wx", ".", "SafeYield", "(", ")", "#dw, dh = wx.DisplaySize()", "size", "=", "wx", ".", "DisplaySize", "(...
Create and fill wxPython grid for entering orientation data.
[ "Create", "and", "fill", "wxPython", "grid", "for", "entering", "orientation", "data", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L619-L639
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_unpack
def on_btn_unpack(self, event): """ Create dialog to choose a file to unpack with download magic. Then run download_magic and create self.contribution. """ dlg = wx.FileDialog( None, message = "choose txt file to unpack", defaultDir=self.WD, ...
python
def on_btn_unpack(self, event): """ Create dialog to choose a file to unpack with download magic. Then run download_magic and create self.contribution. """ dlg = wx.FileDialog( None, message = "choose txt file to unpack", defaultDir=self.WD, ...
[ "def", "on_btn_unpack", "(", "self", ",", "event", ")", ":", "dlg", "=", "wx", ".", "FileDialog", "(", "None", ",", "message", "=", "\"choose txt file to unpack\"", ",", "defaultDir", "=", "self", ".", "WD", ",", "defaultFile", "=", "\"\"", ",", "style", ...
Create dialog to choose a file to unpack with download magic. Then run download_magic and create self.contribution.
[ "Create", "dialog", "to", "choose", "a", "file", "to", "unpack", "with", "download", "magic", ".", "Then", "run", "download_magic", "and", "create", "self", ".", "contribution", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L641-L681
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_btn_upload
def on_btn_upload(self, event): """ Try to run upload_magic. Open validation mode if the upload file has problems. """ if not self.check_for_uncombined_files(): return outstring="upload_magic.py" print("-I- running python script:\n %s"%(outstring)) ...
python
def on_btn_upload(self, event): """ Try to run upload_magic. Open validation mode if the upload file has problems. """ if not self.check_for_uncombined_files(): return outstring="upload_magic.py" print("-I- running python script:\n %s"%(outstring)) ...
[ "def", "on_btn_upload", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "check_for_uncombined_files", "(", ")", ":", "return", "outstring", "=", "\"upload_magic.py\"", "print", "(", "\"-I- running python script:\\n %s\"", "%", "(", "outstring", ")",...
Try to run upload_magic. Open validation mode if the upload file has problems.
[ "Try", "to", "run", "upload_magic", ".", "Open", "validation", "mode", "if", "the", "upload", "file", "has", "problems", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L684-L751
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_end_validation
def on_end_validation(self, event): """ Switch back from validation mode to main Pmag GUI mode. Hide validation frame and show main frame. """ self.Enable() self.Show() self.magic_gui_frame.Destroy()
python
def on_end_validation(self, event): """ Switch back from validation mode to main Pmag GUI mode. Hide validation frame and show main frame. """ self.Enable() self.Show() self.magic_gui_frame.Destroy()
[ "def", "on_end_validation", "(", "self", ",", "event", ")", ":", "self", ".", "Enable", "(", ")", "self", ".", "Show", "(", ")", "self", ".", "magic_gui_frame", ".", "Destroy", "(", ")" ]
Switch back from validation mode to main Pmag GUI mode. Hide validation frame and show main frame.
[ "Switch", "back", "from", "validation", "mode", "to", "main", "Pmag", "GUI", "mode", ".", "Hide", "validation", "frame", "and", "show", "main", "frame", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L755-L762
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.on_menu_exit
def on_menu_exit(self, event): """ Exit the GUI """ # also delete appropriate copy file try: self.help_window.Destroy() except: pass if '-i' in sys.argv: self.Destroy() try: sys.exit() # can raise TypeError i...
python
def on_menu_exit(self, event): """ Exit the GUI """ # also delete appropriate copy file try: self.help_window.Destroy() except: pass if '-i' in sys.argv: self.Destroy() try: sys.exit() # can raise TypeError i...
[ "def", "on_menu_exit", "(", "self", ",", "event", ")", ":", "# also delete appropriate copy file", "try", ":", "self", ".", "help_window", ".", "Destroy", "(", ")", "except", ":", "pass", "if", "'-i'", "in", "sys", ".", "argv", ":", "self", ".", "Destroy",...
Exit the GUI
[ "Exit", "the", "GUI" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L765-L782
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.check_for_uncombined_files
def check_for_uncombined_files(self): """ Go through working directory and check for uncombined files. (I.e., location1_specimens.txt and location2_specimens.txt but no specimens.txt.) Show a warning if uncombined files are found. Return True if no uncombined files are found OR u...
python
def check_for_uncombined_files(self): """ Go through working directory and check for uncombined files. (I.e., location1_specimens.txt and location2_specimens.txt but no specimens.txt.) Show a warning if uncombined files are found. Return True if no uncombined files are found OR u...
[ "def", "check_for_uncombined_files", "(", "self", ")", ":", "wd_files", "=", "os", ".", "listdir", "(", "self", ".", "WD", ")", "if", "self", ".", "data_model_num", "==", "2", ":", "ftypes", "=", "[", "'er_specimens.txt'", ",", "'er_samples.txt'", ",", "'e...
Go through working directory and check for uncombined files. (I.e., location1_specimens.txt and location2_specimens.txt but no specimens.txt.) Show a warning if uncombined files are found. Return True if no uncombined files are found OR user elects to continue anyway.
[ "Go", "through", "working", "directory", "and", "check", "for", "uncombined", "files", ".", "(", "I", ".", "e", ".", "location1_specimens", ".", "txt", "and", "location2_specimens", ".", "txt", "but", "no", "specimens", ".", "txt", ".", ")", "Show", "a", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L784-L809
PmagPy/PmagPy
programs/pmag_gui.py
MagMainFrame.check_for_meas_file
def check_for_meas_file(self): """ Check the working directory for a measurement file. If not found, show a warning and return False. Otherwise return True. """ if self.data_model_num == 2: meas_file_name = "magic_measurements.txt" dm = "2.5" ...
python
def check_for_meas_file(self): """ Check the working directory for a measurement file. If not found, show a warning and return False. Otherwise return True. """ if self.data_model_num == 2: meas_file_name = "magic_measurements.txt" dm = "2.5" ...
[ "def", "check_for_meas_file", "(", "self", ")", ":", "if", "self", ".", "data_model_num", "==", "2", ":", "meas_file_name", "=", "\"magic_measurements.txt\"", "dm", "=", "\"2.5\"", "else", ":", "meas_file_name", "=", "\"measurements.txt\"", "dm", "=", "\"3.0\"", ...
Check the working directory for a measurement file. If not found, show a warning and return False. Otherwise return True.
[ "Check", "the", "working", "directory", "for", "a", "measurement", "file", ".", "If", "not", "found", "show", "a", "warning", "and", "return", "False", ".", "Otherwise", "return", "True", "." ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/pmag_gui.py#L811-L826
PmagPy/PmagPy
programs/dayplot_magic.py
main
def main(): """ NAME dayplot_magic.py DESCRIPTION makes 'day plots' (Day et al. 1977) and squareness/coercivity, plots 'linear mixing' curve from Dunlop and Carter-Stiglitz (2006). squareness coercivity of remanence (Neel, 1955) plots after Tauxe et al. (2002) ...
python
def main(): """ NAME dayplot_magic.py DESCRIPTION makes 'day plots' (Day et al. 1977) and squareness/coercivity, plots 'linear mixing' curve from Dunlop and Carter-Stiglitz (2006). squareness coercivity of remanence (Neel, 1955) plots after Tauxe et al. (2002) ...
[ "def", "main", "(", ")", ":", "args", "=", "sys", ".", "argv", "if", "\"-h\"", "in", "args", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "dir_path", "=", "pmag", ".", "get_named_arg", "(", "'-WD'", ",", "'.'", ")...
NAME dayplot_magic.py DESCRIPTION makes 'day plots' (Day et al. 1977) and squareness/coercivity, plots 'linear mixing' curve from Dunlop and Carter-Stiglitz (2006). squareness coercivity of remanence (Neel, 1955) plots after Tauxe et al. (2002) SYNTAX dayplo...
[ "NAME", "dayplot_magic", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/dayplot_magic.py#L12-L45
PmagPy/PmagPy
dialogs/pmag_gui_menu2.py
MagICMenu.on_import1
def on_import1(self, event): """ initialize window to import an arbitrary file into the working directory """ pmag_menu_dialogs.MoveFileIntoWD(self.parent, self.parent.WD)
python
def on_import1(self, event): """ initialize window to import an arbitrary file into the working directory """ pmag_menu_dialogs.MoveFileIntoWD(self.parent, self.parent.WD)
[ "def", "on_import1", "(", "self", ",", "event", ")", ":", "pmag_menu_dialogs", ".", "MoveFileIntoWD", "(", "self", ".", "parent", ",", "self", ".", "parent", ".", "WD", ")" ]
initialize window to import an arbitrary file into the working directory
[ "initialize", "window", "to", "import", "an", "arbitrary", "file", "into", "the", "working", "directory" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_menu2.py#L168-L172
PmagPy/PmagPy
dialogs/pmag_gui_menu2.py
MagICMenu.orient_import2
def orient_import2(self, event): """ initialize window to import an AzDip format file into the working directory """ pmag_menu_dialogs.ImportAzDipFile(self.parent, self.parent.WD)
python
def orient_import2(self, event): """ initialize window to import an AzDip format file into the working directory """ pmag_menu_dialogs.ImportAzDipFile(self.parent, self.parent.WD)
[ "def", "orient_import2", "(", "self", ",", "event", ")", ":", "pmag_menu_dialogs", ".", "ImportAzDipFile", "(", "self", ".", "parent", ",", "self", ".", "parent", ".", "WD", ")" ]
initialize window to import an AzDip format file into the working directory
[ "initialize", "window", "to", "import", "an", "AzDip", "format", "file", "into", "the", "working", "directory" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_gui_menu2.py#L177-L181
PmagPy/PmagPy
programs/plot_map_pts.py
main
def main(): """ NAME plot_map_pts.py DESCRIPTION plots points on map SYNTAX plot_map_pts.py [command line options] OPTIONS -h prints help and quits -sym [ro, bs, g^, r., b-, etc.] [1,5,10] symbol and size for points colors are r=red,b=blue,g=g...
python
def main(): """ NAME plot_map_pts.py DESCRIPTION plots points on map SYNTAX plot_map_pts.py [command line options] OPTIONS -h prints help and quits -sym [ro, bs, g^, r., b-, etc.] [1,5,10] symbol and size for points colors are r=red,b=blue,g=g...
[ "def", "main", "(", ")", ":", "dir_path", "=", "'.'", "plot", "=", "0", "ocean", "=", "0", "res", "=", "'c'", "proj", "=", "'moll'", "Lats", ",", "Lons", "=", "[", "]", ",", "[", "]", "fmt", "=", "'pdf'", "sym", "=", "'ro'", "symsize", "=", "...
NAME plot_map_pts.py DESCRIPTION plots points on map SYNTAX plot_map_pts.py [command line options] OPTIONS -h prints help and quits -sym [ro, bs, g^, r., b-, etc.] [1,5,10] symbol and size for points colors are r=red,b=blue,g=green, etc. sy...
[ "NAME", "plot_map_pts", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/plot_map_pts.py#L14-L213
PmagPy/PmagPy
programs/s_hext.py
main
def main(): """ NAME s_hext.py DESCRIPTION calculates Hext statistics for tensor data SYNTAX s_hext.py [-h][-i][-f file] [<filename] OPTIONS -h prints help message and quits -f file specifies filename on command line -l NMEAS do line by line instead of...
python
def main(): """ NAME s_hext.py DESCRIPTION calculates Hext statistics for tensor data SYNTAX s_hext.py [-h][-i][-f file] [<filename] OPTIONS -h prints help message and quits -f file specifies filename on command line -l NMEAS do line by line instead of...
[ "def", "main", "(", ")", ":", "ave", "=", "1", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "if", "'-l'", "in", "sys", ".", "argv", ":", "ind", "=", "sys", ".", "argv", ...
NAME s_hext.py DESCRIPTION calculates Hext statistics for tensor data SYNTAX s_hext.py [-h][-i][-f file] [<filename] OPTIONS -h prints help message and quits -f file specifies filename on command line -l NMEAS do line by line instead of whole file, use number ...
[ "NAME", "s_hext", ".", "py" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/s_hext.py#L8-L76
PmagPy/PmagPy
data_files/LearningPython/UTM.py
_UTMLetterDesignator
def _UTMLetterDesignator(Lat): """ This routine determines the correct UTM letter designator for the given latitude returns 'Z' if latitude is outside the UTM limits of 84N to 80S Written by Chuck Gantz- chuck.gantz@globalstar.com """ if 84 >= Lat >= 72: return 'X' ...
python
def _UTMLetterDesignator(Lat): """ This routine determines the correct UTM letter designator for the given latitude returns 'Z' if latitude is outside the UTM limits of 84N to 80S Written by Chuck Gantz- chuck.gantz@globalstar.com """ if 84 >= Lat >= 72: return 'X' ...
[ "def", "_UTMLetterDesignator", "(", "Lat", ")", ":", "if", "84", ">=", "Lat", ">=", "72", ":", "return", "'X'", "elif", "72", ">", "Lat", ">=", "64", ":", "return", "'W'", "elif", "64", ">", "Lat", ">=", "56", ":", "return", "'V'", "elif", "56", ...
This routine determines the correct UTM letter designator for the given latitude returns 'Z' if latitude is outside the UTM limits of 84N to 80S Written by Chuck Gantz- chuck.gantz@globalstar.com
[ "This", "routine", "determines", "the", "correct", "UTM", "letter", "designator", "for", "the", "given", "latitude", "returns", "Z", "if", "latitude", "is", "outside", "the", "UTM", "limits", "of", "84N", "to", "80S", "Written", "by", "Chuck", "Gantz", "-", ...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/data_files/LearningPython/UTM.py#L123-L150
PmagPy/PmagPy
data_files/LearningPython/UTM.py
UTMtoLL
def UTMtoLL(ReferenceEllipsoid, easting, northing, zone): """ converts UTM coords to lat/long. Equations from USGS Bulletin 1532 East Longitudes are positive, West longitudes are negative. North latitudes are positive, South latitudes are negative Lat and Long are in decimal deg...
python
def UTMtoLL(ReferenceEllipsoid, easting, northing, zone): """ converts UTM coords to lat/long. Equations from USGS Bulletin 1532 East Longitudes are positive, West longitudes are negative. North latitudes are positive, South latitudes are negative Lat and Long are in decimal deg...
[ "def", "UTMtoLL", "(", "ReferenceEllipsoid", ",", "easting", ",", "northing", ",", "zone", ")", ":", "k0", "=", "0.9996", "a", "=", "_ellipsoid", "[", "ReferenceEllipsoid", "]", "[", "_EquatorialRadius", "]", "eccSquared", "=", "_ellipsoid", "[", "ReferenceEll...
converts UTM coords to lat/long. Equations from USGS Bulletin 1532 East Longitudes are positive, West longitudes are negative. North latitudes are positive, South latitudes are negative Lat and Long are in decimal degrees. Written by Chuck Gantz- chuck.gantz@globalstar.com Conve...
[ "converts", "UTM", "coords", "to", "lat", "/", "long", ".", "Equations", "from", "USGS", "Bulletin", "1532", "East", "Longitudes", "are", "positive", "West", "longitudes", "are", "negative", ".", "North", "latitudes", "are", "positive", "South", "latitudes", "...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/data_files/LearningPython/UTM.py#L152-L206
PmagPy/PmagPy
programs/magic_gui.py
MainFrame.InitUI
def InitUI(self): """ Make main user interface """ bSizer0 = wx.StaticBoxSizer( wx.StaticBox(self.panel, wx.ID_ANY, "Choose MagIC project directory", name='bSizer0'), wx.HORIZONTAL ) self.dir_path = wx.TextCtrl(self.panel, id=-1, size=(600, 25), style=wx.TE_RE...
python
def InitUI(self): """ Make main user interface """ bSizer0 = wx.StaticBoxSizer( wx.StaticBox(self.panel, wx.ID_ANY, "Choose MagIC project directory", name='bSizer0'), wx.HORIZONTAL ) self.dir_path = wx.TextCtrl(self.panel, id=-1, size=(600, 25), style=wx.TE_RE...
[ "def", "InitUI", "(", "self", ")", ":", "bSizer0", "=", "wx", ".", "StaticBoxSizer", "(", "wx", ".", "StaticBox", "(", "self", ".", "panel", ",", "wx", ".", "ID_ANY", ",", "\"Choose MagIC project directory\"", ",", "name", "=", "'bSizer0'", ")", ",", "wx...
Make main user interface
[ "Make", "main", "user", "interface" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L89-L235
PmagPy/PmagPy
programs/magic_gui.py
MainFrame.on_change_dir_button
def on_change_dir_button(self, event=None): """ create change directory frame """ currentDirectory = self.WD #os.getcwd() change_dir_dialog = wx.DirDialog(self.panel, "Choose your working directory to create or edit a MagIC contribution:",...
python
def on_change_dir_button(self, event=None): """ create change directory frame """ currentDirectory = self.WD #os.getcwd() change_dir_dialog = wx.DirDialog(self.panel, "Choose your working directory to create or edit a MagIC contribution:",...
[ "def", "on_change_dir_button", "(", "self", ",", "event", "=", "None", ")", ":", "currentDirectory", "=", "self", ".", "WD", "#os.getcwd()", "change_dir_dialog", "=", "wx", ".", "DirDialog", "(", "self", ".", "panel", ",", "\"Choose your working directory to creat...
create change directory frame
[ "create", "change", "directory", "frame" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L238-L254
PmagPy/PmagPy
programs/magic_gui.py
MainFrame.make_grid_frame
def make_grid_frame(self, event): """ Create a GridFrame for data type of the button that was clicked """ if self.grid_frame: print('-I- You already have a grid frame open') pw.simple_warning("You already have a grid open") return try: ...
python
def make_grid_frame(self, event): """ Create a GridFrame for data type of the button that was clicked """ if self.grid_frame: print('-I- You already have a grid frame open') pw.simple_warning("You already have a grid open") return try: ...
[ "def", "make_grid_frame", "(", "self", ",", "event", ")", ":", "if", "self", ".", "grid_frame", ":", "print", "(", "'-I- You already have a grid frame open'", ")", "pw", ".", "simple_warning", "(", "\"You already have a grid open\"", ")", "return", "try", ":", "gr...
Create a GridFrame for data type of the button that was clicked
[ "Create", "a", "GridFrame", "for", "data", "type", "of", "the", "button", "that", "was", "clicked" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L287-L378
PmagPy/PmagPy
programs/magic_gui.py
MainFrame.highlight_problems
def highlight_problems(self, has_problems): """ Outline grid buttons in red if they have validation errors """ if has_problems: self.validation_mode = set(has_problems) # highlighting doesn't work with Windows if sys.platform in ['win32', 'win62']: ...
python
def highlight_problems(self, has_problems): """ Outline grid buttons in red if they have validation errors """ if has_problems: self.validation_mode = set(has_problems) # highlighting doesn't work with Windows if sys.platform in ['win32', 'win62']: ...
[ "def", "highlight_problems", "(", "self", ",", "has_problems", ")", ":", "if", "has_problems", ":", "self", ".", "validation_mode", "=", "set", "(", "has_problems", ")", "# highlighting doesn't work with Windows", "if", "sys", ".", "platform", "in", "[", "'win32'"...
Outline grid buttons in red if they have validation errors
[ "Outline", "grid", "buttons", "in", "red", "if", "they", "have", "validation", "errors" ]
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L402-L431