-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from varchasgopalaswamy/main
Preliminary Pandas support
- Loading branch information
Showing
38 changed files
with
3,271 additions
and
2,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
on: [push] | ||
|
||
jobs: | ||
paper: | ||
runs-on: ubuntu-latest | ||
name: Paper Draft | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build draft PDF | ||
uses: openjournals/openjournals-draft-action@master | ||
with: | ||
journal: joss | ||
# This should be the path to the paper within your repo. | ||
paper-path: paper/paper.md | ||
- name: Upload | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: paper | ||
# This is the output path where Pandoc will write the compiled | ||
# PDF. Note, this should be the same directory as the input | ||
# paper.md | ||
path: paper/paper.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,37 @@ | ||
repos: | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.275 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix, --exit-non-zero-on-fix ] | ||
|
||
- repo: https://github.com/psf/black.git | ||
rev: 23.1.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.9 | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
- repo: local | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
|
||
- id: generate-init | ||
name: Generates __init__.py files | ||
language: python | ||
entry: python hooks/generate_init.py | ||
always_run: true | ||
require_serial: true | ||
additional_dependencies: ["mkinit", "ruff"] | ||
|
||
- id: fix-line-endings | ||
name: Convert CRLF/CR endings to LF | ||
language: python | ||
require_serial: true | ||
entry: python hooks/fix_line_endings.py | ||
types: ["text"] | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
rev: v4.6.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: fix-encoding-pragma | ||
- id: trailing-whitespace | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: debug-statements | ||
- id: mixed-line-ending | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.4.6 | ||
hooks: | ||
#Run the formatter. | ||
- id: ruff-format | ||
types_or: [ python, pyi, jupyter ] | ||
#Run the linter. | ||
- id: ruff | ||
types_or: [ python, pyi, jupyter ] | ||
args: [ --fix, --exit-zero ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import annotations | ||
|
||
import numpy as np | ||
|
||
|
||
class NegativeStdDevError(Exception): | ||
"""An exception for when the standard deviation is negative""" | ||
|
||
pass | ||
|
||
|
||
class NumpyDowncastWarning(RuntimeWarning): | ||
"""An exception for when an uncertainties array is downcast to a numpy array""" | ||
|
||
pass | ||
|
||
|
||
from .uncertainty import Uncertainty # noqa: E402 | ||
|
||
try: | ||
from .pandas_compat import UncertaintyArray | ||
except ImportError: | ||
UncertaintyArray = None | ||
|
||
|
||
def nominal_values(x): | ||
# Is an Uncertainty | ||
if hasattr(x, "_nom"): | ||
return x.value | ||
else: | ||
if np.ndim(x) > 0: | ||
try: | ||
x2 = Uncertainty.from_sequence(x) | ||
except Exception: | ||
return x | ||
else: | ||
return x2.value | ||
else: | ||
try: | ||
x2 = Uncertainty(x) | ||
except Exception: | ||
return x | ||
else: | ||
return x2.value | ||
|
||
|
||
def std_devs(x): | ||
# Is an Uncertainty | ||
if hasattr(x, "_err"): | ||
return x.error | ||
else: | ||
if np.ndim(x) > 0: | ||
try: | ||
x2 = Uncertainty.from_sequence(x) | ||
except Exception: | ||
return np.zeros_like(x) | ||
else: | ||
return x2.error | ||
else: | ||
try: | ||
x2 = Uncertainty(x) | ||
except Exception: | ||
return 0 | ||
else: | ||
return x2.error | ||
__private__ = ["util"] | ||
__protected__ = ["numpy"] | ||
import lazy_loader | ||
|
||
|
||
__getattr__, __dir__, __all__ = lazy_loader.attach_stub(__name__, __file__) | ||
|
||
__all__ = [ | ||
"DowncastError", | ||
"DowncastWarning", | ||
"NegativeStdDevError", | ||
"ScalarDisplay", | ||
"ScalarUncertainty", | ||
"Uncertainty", | ||
"UncertaintyArray", | ||
"UncertaintyDtype", | ||
"VectorDisplay", | ||
"VectorUncertainty", | ||
"display_format", | ||
"exceptions", | ||
"nominal_values", | ||
"numpy", | ||
"pandas", | ||
"set_compare_error", | ||
"set_display_rounding", | ||
"set_downcast_error", | ||
"std_devs", | ||
"unc_array", | ||
"unc_dtype", | ||
"uncertainty", | ||
"uncertainty_containers", | ||
"util", | ||
] |
Oops, something went wrong.