Skip to content

Testing sources#53

Merged
rstoneback merged 199 commits intodevelopfrom
testing_sources
Dec 24, 2021
Merged

Testing sources#53
rstoneback merged 199 commits intodevelopfrom
testing_sources

Conversation

@rstoneback
Copy link
Copy Markdown
Collaborator

@rstoneback rstoneback commented Dec 6, 2021

Description

Adds support for pure dipole and linear quadrupole sources to verify performance of OMMBV on multipole sources.

Addresses a variety of issues, including documented issues #50, #44.

Provides direct evidence that vectors are orthogonal for multipole fields.

Original Performance

There is an apparent reduction in performance for some linear quadrupoles in the equatorial plane. Current uncertainty on scaling values for drifts and electric fields is < 0.1%. In practical terms, given instrumentation errors are certainly higher, the observed uncertainty is fine for scientific applications. Still, looking to see if there is a way to improve this performance. Scaling uncertainty for dipole and linear quadrupole (along pole) is < .001%.

UPDATE

Performance improved and uncertainty with multipole fields is the same as dipole alone! Fixes are in here.
Also includes:

  • docstring improvements
  • code standard improvements
  • deprecation warning improvements
  • unit test overhaul
  • code reduction
  • bug fixes
  • Documentation runs on RTD again
  • Switch to setup.cfg
  • Switch to GitHub Actions for testing

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New test feature (non-breaking change which adds functionality)

How Has This Been Tested?

Running unit tests on known source magnetic fields.

Test Configuration:

  • MacOS
  • Python 3.8

Checklist:

  • Make sure you are merging into the develop (not master) branch
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes

@rstoneback
Copy link
Copy Markdown
Collaborator Author

I sorted out a bit of error and now the OMMBV vectors are even better. Uncertainty for multipole fields is at the same level as a pure dipole.

@rstoneback
Copy link
Copy Markdown
Collaborator Author

I'm giving up on windows testing. OMMBC appears to compile everything just fine. However, pytest tests the pure python code without the compiled and installed Fortran. I also dropped MacOS testing way back since there is no installed Fortran compiler on the machines. Runs locally on Mac.

Copy link
Copy Markdown
Contributor

@jklenzing jklenzing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some structural suggestions on the workflows and cfg. Pulling out windows support is probably the right route for now. Included new minimum NEP29 versions as of Dec 26 2021.

Comment thread setup.cfg
Comment thread setup.py

# Include extensions only when not on readthedocs.org
if os.environ.get('READTHEDOCS', None) == 'True':
extensions = []
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extensions = []
from setuptools import setup
extensions = []

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found the first setup needs to be at top level for setup.py develop to work.

Comment thread setup.py
with open(os.path.join(here, version_filename)) as version_file:
version = version_file.read().strip()
import os
from setuptools import setup
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from setuptools import setup

Comment thread setup.py
else:
from numpy.distutils.core import setup, Extension
from numpy.distutils.core import Extension
from numpy.distutils.core import setup # noqa: F811
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from numpy.distutils.core import setup # noqa: F811
from numpy.distutils.core import setup

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flake8 or whatever complains about a redefinition of setup if the noqa isn't there. If I don't have the original setup import though then python setup.py develop doesn't work.

Comment thread .github/workflows/main.yml Outdated
Comment thread .github/workflows/main.yml Outdated
Comment thread .github/workflows/main.yml Outdated

- name: Run OMMBV setup.py
run: |
pip install -e ../OMMBV -t ../OMMBV
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not windows compatible

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have yet to find a windows compatible command that really installs the package. It goes through the motions, compiles the Fortran, etc, however, I can't get pytest to use whatever is installed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it's skipping this part on windows. Github Actions will still try to load code locally if not installed.

Could probably set up os-dependent jobs here, one for unix, one for windows. But we'd need to test it on a windows machine locally, since I'm not sure if it's as easy as swapping directories. I'd bump this down the line since this is a big pull. Perhaps @JonathonMSmith can help?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that I need help from someone with a local windows machine. From the Actions tab windows does run the pip install stuff and it runs without error. I used to have python setup.py develop which I'll probably go back to.

Comment thread setup.cfg
long_description = file: README.md, CHANGELOG.md
long_description_content_type = text/markdown
classifiers =
Development Status :: 5 - Production/Stable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is pre-1.0 production?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am prepping 1.0 here.

Comment thread setup.cfg Outdated
Comment on lines +17 to +21
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Operating System :: MacOS :: MacOS X
Operating System :: POSIX :: Linux
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update based on which tests are run

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally left Mac on there since I'm running local tests. I can update if the standard is to report what is publicly run.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment thread CHANGELOG.md Outdated
@rstoneback rstoneback merged commit 03b9d7f into develop Dec 24, 2021
@rstoneback rstoneback deleted the testing_sources branch December 24, 2021 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants