Package: pyoscode
AboutInstallationDependenciesPythonC++Quick startPythonC++DocumentationCitationContributingFurther helpFAQsThanksChangelogAboutOscode is a C++ tool with a Python interface that solvesoscillatoryordinarydifferentialequations efficiently. It is designed to
deal with equations of the formwhere(friction term) and(frequency) can be given as arrays.Oscode makes use of an analytic approximation of x(t) embedded in a
stepping procedure to skip over long regions of oscillations, giving a reduction
in computing time. The approximation is valid when the frequency changes slowly
relative to the timescales of integration, it is therefore worth applying when
this condition holds for at least some part of the integration range.For the details of the numerical method used by oscode, seeCitation.InstallationDependenciesBasic requirements for using the C++ interface:C++11 or laterEigen(a header-only library included in this source)The strictly necessary Python dependencies are automatically installed when you usepipor thesetup.py. They are:numpyTheoptionaldependencies are:for testsscipypytestfor examples/plottingmatplotlibscipyfor generating offline documentationsphinxdoxygenbreatheexhalePythonpyoscodecan be installed via pippipinstallpyoscodeor via the setup.pygitclonehttps://github.com/fruzsinaagocs/oscodecdoscodepythonsetup.pyinstall--userorgitclonehttps://github.com/fruzsinaagocs/oscodecdoscodepipinstall.You can then importpyoscodefrom anywhere. Omit the--useroption if
you wish to install globally or in a virtual environment. If you have any
difficulties, check out theFAQs - Installationsection below.You can check that things are working by runningtests/(also ran by Travis continuous integration):pytesttests/C++oscodeis a header-only C++ package, it requires no installation.gitclonehttps://github.com/fruzsinaagocs/oscodeand then include the relevant header files in your C++ code:#include"solver.hpp"#include"system.hpp"Quick startTry the following quick examples. They are available in theexamples.PythonIntroduction to pyoscode:Cosmology examples:Scipy 2020 lecture notebook:C++Introduction to oscode:examples/burst.cppTo plot results fromburst.cpp:examples/plot_burst.pyTo compile and run:cdexamples/g++-I../include/-g-Wall-std=c++11-c-oburst.oburst.cppg++-I../include/-g-Wall-std=c++11-oburstburst.o./burstDocumentationDocumentation is hosted atreadthedocs.To build your own local copy of the documentation you can run:cdpyoscode/docsmakehtmlCitationIf you useoscodeto solve equations for a publication, please cite:Efficient method for solving highly oscillatory ordinary differential equations with applications to physical systems,Dense output for highly oscillatory numerical solutionsContributingAny comments and improvements to this project are welcome. You can contribute
by:Opening andissueto report bugs and propose new features.Making a pull request.Further helpYou can get help by submitting an issue or posting a message onGitter.FAQsInstallationEigen import errors:pyoscode/_pyoscode.hpp:6:10:fatalerror:Eigen/Dense:Nosuchfileordirectory#include <Eigen/Dense>^~~~~~~~~~~~~Try explicitly including the location of your Eigen library via theCPLUS_INCLUDE_PATHenvironment variable, for example:CPLUS_INCLUDE_PATH=/usr/include/eigen3pythonsetup.pyinstall--user# orCPLUS_INCLUDE_PATH=/usr/include/eigen3pipinstallpyoscodewhere/usr/include/eigen3should be replaced with your system-specific
eigen location.ThanksMany thanks toWill Handley,Lukas Hergt,Anthony Lasenby, andMike Hobsonfor
their support and advice regarding the algorithm behindoscode.
There are many packages without which some part ofoscode(e.g. testing and
examples) wouldn’t run as nicely and smoothly, thank you all developers for
making and maintaining these open-source projects. A special thanks goes to the
devs ofexhalefor making the beautiful C++ documentation possible.Changelog1.1.2:Dense output bug fix at the C++ interface1.1.1:Support for mac and Windows OS at CI.1.1.0:Users can now define w, g as functions in Python (pyoscode) and call the solver via pyoscode.solve_fn(…)1.0.6:Fix issues related to dense output not being correctly generated, e.g. when timepoints at which dense output was asked for are in descending order, etc.1.0.5:Fixes related to dense output generationSupport for w, g to be given as class member functions in C++Switched to GH actions for continuous integration, and fixed code such that unit tests would run againMinor tweaks1.0.4:set minimally required numpy version: numpy>=1.20.0drop Python 2.7 support, instead support 3.8 and 3.9 in addition to 3.71.0.3:paper accepted to JOSS1.0.2:Fixed getting correct numpy include directories1.0.1:Addedpyproject.tomlto handle build dependencies (numpy)1.0.0:Dense outputArrays for frequency and damping term need not be evenly spacedAutomatic C++ documentation on readthedocsEigen included in source for pip installabilityFirst pip release :)0.1.2:Bug that occurred when beginning and end of integration coincided
corrected0.1.1:Automatic detection of direction of integration0.1.0:Memory leaks at python interface fixedC++ documentation added