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_documentation_string
stringlengths
1
47.2k
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 -------- ...
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...
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...
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, ``**/...
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') ...
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...
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. ...
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.
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...
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 ...
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...
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`...
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...
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.
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, ...
Determines if the build is in debug mode. Returns ------- debug : bool True if the current build was started with the debug option, False otherwise.
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...
This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``.
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...
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...
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') ...
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.
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: ...
Run hooks registered for that command and phase. *cmd_obj* is a finalized command object; *hook_kind* is either 'pre_hook' or 'post_hook'.
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. ""...
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.
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...
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...
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...
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.
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 ...
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...
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...
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...
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 ...
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...
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 ['...
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`.
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...
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.
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 ...
Returns the previously used Cython version (or 'unknown' if not previously built) if Cython should be used to build extension modules from pyx files.
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...
Where relevant, make sure that the .c files associated with .pyx modules are present (if building without Cython installed).
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...
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...
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...
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...
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...
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 `...
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
Determine whether the build compiler has OpenMP support.
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...
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.
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': ...
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.
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 ''
Find the matching value from pandas DataFrame, return it.
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
Set value in the pandas DataFrame
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 ...
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
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 ''
Get col label from dataframe
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
Set col label value in dataframe
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: ...
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.
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...
Add items and/or update existing items in grid
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(...
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.
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 ...
sets self.changes to true when user edits the grid. provides down and up key functionality for exiting the editor
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...
Read clipboard into dataframe Paste data into grid, adding extra rows if needed and ignoring extra columns.
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...
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.
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...
Take row, column, and turn it color
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...
Update table dataframe, and append a new column Parameters ---------- label : str Returns --------- last_col: int index column number of added col
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] ...
update table dataframe, and remove a column. resize grid to display correctly
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 ...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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 ...
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
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...
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...
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...
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
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...
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)
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...
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)
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(...
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)
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...
input: sum_ptrm_checks, sum_abs_ptrm_checks, n_pTRM, delta_x_prime output: Mean deviation of a pTRM check
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...
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).
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] ...
input: ptrms_vectors, ptrm_checks_vectors, ptrms_orig, checks_orig output: vector diffs between original and ptrm check, C
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...
input: C, ptrms_vectors, start, end output: TRM_star, x_star (for delta_pal statistic)
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...
input: x_star, y_err, y_mean, y_segment output: b_star (corrected slope for delta_pal statistic)
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
input: b, b_star (actual and corrected slope) output: delta_pal
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...
input: PTRMS, PTRM_Checks, NRM, y_err, y_mean, b, start, end, y_segment runs full sequence necessary to get delta_pal
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...
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
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()...
Makes this fit the selected fit on the GUI that is it's parent (Note: may be moved into GUI soon)
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 == ...
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
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...
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 ...
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 ...
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
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: # ...
determines number of included tail checks in best fit segment
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 ...
input: y_Arai, y_tail, t_Arai, tail_temps, n_tail output: max_check, diffs
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
input: tail_check_max, best fit line length output: DRAT_tail
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
input: tail_check_max, y_intercept output: delta_TR
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
input: tail_check_max, vector difference sum output: MD_VDS
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...
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'
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...
Make GUI changes based on data model num. Get info from WD in appropriate format.
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...
Show dialog to get user input for which directory to set as working directory. Called by self.get_dm_and_wd
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 ...
Get 2.5 data from self.WD and put it into ErMagicBuilder object. Called by get_dm_and_wd
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") ...
Build the mainframe
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 = ...
Choose a working directory dialog. Called by self.get_dm_and_wd.
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"%...
Open Thellier GUI
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...
Open Demag GUI
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...
Open dialog for rough conversion of 2.5 files to 3.0 files. Offer link to earthref for proper upgrade.
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 ...
Initiate the series of windows to add metadata to the contribution.
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...
initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc.
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', ...
initiates the object that will control steps 1-6 of checking headers, filling in cell values, etc.
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...
Create and fill wxPython grid for entering orientation data.
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, ...
Create dialog to choose a file to unpack with download magic. Then run download_magic and create self.contribution.
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)) ...
Try to run upload_magic. Open validation mode if the upload file has problems.
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()
Switch back from validation mode to main Pmag GUI mode. Hide validation frame and show main frame.
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...
Exit the GUI
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...
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.
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" ...
Check the working directory for a measurement file. If not found, show a warning and return False. Otherwise return True.
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) ...
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...
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)
initialize window to import an arbitrary file into the working directory
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)
initialize window to import an AzDip format file into the working directory
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...
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...
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...
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 ...
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' ...
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
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...
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...
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...
Make main user interface
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:",...
create change directory frame
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: ...
Create a GridFrame for data type of the button that was clicked
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']: ...
Outline grid buttons in red if they have validation errors
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L402-L431