Giter VIP home page Giter VIP logo

cxroots's People

Contributors

dependabot[bot] avatar fchapoton avatar gfidlab-ci-user avatar llohse avatar pyup-bot avatar renovate[bot] avatar rparini avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cxroots's Issues

PEP8 compliance

Biggest change is to rename variables to snake_case. Huge breaking change, will require a major version bump.

Improve `iterative_methods` structure

  1. There is a certain amount of repetition in the stopping criteria for newton, secant and muller, these could probably be centralised to reduce repetition, perhaps in some stop_iteration function.
  2. Would be nice to use some more battle-tested implementaions for these standard methods, rather than my own.
    • I think I originally passed on scipy.optimize.newton before because of scipy/scipy#10103 but it has now been pointed out that casting x0 to np.complex128 works around that. I also make use of callbacks during the iteration in my cuurent implemention but could probably get the same effect by wrapping the target func passed to scipy.optimize.newton.
    • Or maybe threre`s some other capability in mpmath or numdifftools that could be used more easily.

Type annotations

Would be helpful for Pylance to have type hints on functions. Could also run mypy/pyright/pytype in a github action to verify types

Will probably go with Pyright because I use that at work and it has good integration with VSCode via pylance.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/actions/build-docs/action.yml
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
.github/workflows/analysis.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • github/codeql-action v3@23acc5c183826b7a8a97bce3cecc52db901f8251
  • github/codeql-action v3@23acc5c183826b7a8a97bce3cecc52db901f8251
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • github/codeql-action v3@23acc5c183826b7a8a97bce3cecc52db901f8251
.github/workflows/publish.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • stefanzweifel/git-auto-commit-action v5@8621497c8c39c72f3e2a999a26b4ca1b5058a842
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
.github/workflows/tests.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
  • coverallsapp/github-action master
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
pip_requirements
requirements.txt
  • scipy ==1.13.1
  • numpy ==1.26.4
  • numpydoc ==1.7.0
  • mpmath ==1.3.0
  • rich ==13.7.1
  • matplotlib ==3.9.0
  • pytest ==8.2.2
  • pytest-xdist ==3.6.1
  • pytest-cov ==5.0.0
  • setuptools >=65.5.1
requirements_analysis.txt
  • black ==24.4.2
  • isort ==5.13.2
  • flake8 ==7.1.0
  • pep8-naming ==0.14.1
  • bandit ==1.7.9
  • bandit-sarif-formatter ==1.1.1
  • pyright ==1.1.369
requirements_doc.txt
  • nbsphinx ==0.9.4
  • sphinx ==7.3.7
  • sphinxcontrib-programoutput ==0.17
  • sphinxcontrib-bibtex ==2.6.2
  • sphinx_rtd_theme ==2.0.0
  • sphinx-github-changelog ==1.3.0
  • ipython ==8.26.0
  • nbconvert ==7.16.4
  • ipython_genutils ==0.2.0
  • mistune ==3.0.2
  • setuptools ==70.1.1
  • wheel ==0.43.0
  • twine ==5.1.1
pre-commit
.pre-commit-config.yaml
  • psf/black 24.4.2
  • pycqa/isort 5.13.2

  • Check this box to trigger a request for Renovate to run again on this repository

Fix wheel build deprecation warnings

The current method of building wheels is python setup.py sdist bdist_wheel but gives

/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.

and

/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

Rootfinding sensitive to the area of the contour

Hi,
Iโ€™m using cxroots to find all the roots of a complex function f(z). When I choose a rectangle of size real(-5000,5000), imag(-5000,5000), it gives me 14 roots, each with multiplicity 1. The roots are symmetric about the imaginary axis. That is it has 7 roots of the form x+iy and other 7 roots of the form -x+iy.
So, when I choose a rectangle of size real(0,5000), imag(-5000,5000), it gives me only 5 roots (two roots with a multiplicity of 2). Which implies, it did not detect two roots compared to the former case. The interesting thing is, if I specify a circle (2500,2500) instead of a rectangle, it gives me all the seven roots. Why is this happening?

Thanks.

Depfu Error: No dependency files found

Hello,

We've tried to activate or update your repository on Depfu and couldn't find any supported dependency files. If we were to guess, we would say that this is not actually a project Depfu supports and has probably been activated by error.

Monorepos

Please note that Depfu currently only searches for your dependency files in the root folder. We do support monorepos and non-root files, but don't auto-detect them. If that's the case with this repo, please send us a quick email with the folder you want Depfu to work on and we'll set it up right away!

How to deactivate the project

  • Go to the Settings page of either your own account or the organization you've used
  • Go to "Installed Integrations"
  • Click the "Configure" button on the Depfu integration
  • Remove this repo (rparini/cxroots) from the list of accessible repos.

Please note that using the "All Repositories" setting doesn't make a lot of sense with Depfu.

If you think that this is a mistake

Please let us know by sending an email to [email protected].


This is an automated issue by Depfu. You're getting it because someone configured Depfu to automatically update dependencies on this project.

Make filenames consistent

We have some files like AnnulusSector.py and others like test_rootfinding_contours.py. We should have a consistnet naming convention

Literature Notes

Improving derivative-free case

When df is not provided we currently approximate it using a finite difference method

if df is None:
df = numdifftools.Derivative(f, order=df_approx_order)
# df = lambda z: scipy.misc.derivative(f, z, dx=1e-8, n=1, order=3)
# Too slow
# import numdifftools.fornberg as ndf
# ndf.derivative returns an array [f, f', f'', ...]
# df = np.vectorize(lambda z: ndf.derivative(f, z, n=1)[1])

Is there a better way of doing this? I feel like knowing f is complex analytic should let us do something more clever but not sure what. I've seen literature involving contour integrations to do this (and I implemented an approach in the cxroots.derivative.cx_derivative function) but integration can involve a lot of function evaluations. Possibly relevant reading:

Alternatively, perhaps we could take a different approach to rootfinding that avoids approximating df when it is not provided. Possibly relevant reading:

Cluster handling

Can we improve how we handle clusters of roots?

Triage test warnings

There are quite a lot of warnings raised when running the pytest test suite. What can we address?

Add progress bar

A progress bar with "N/M roots found" would be a good middle ground between printing nothing (currently verbose=False) and printing a huge amount of debugging output (currently verbose=True). Not sure if this should be toggled by a new parameter or a new verbose level (verbose=1,2 or 3 instead of True/False).

Remove `integrate_quad_complex`

scipy.integrate.quad added a complex_func argument in v1.10.0 which should let us get rid of the cxroots integrate_quad_complex. Should set scipy range in setup.py

Arrows in root.show() and contour.show() have size-dependent width

For small contours (diameter < 1e-3), the arrows drawn by contour.show() becomes huge and eventually fills the whole figure.
To reproduce:

c = cxroots.Rectangle((-1e-4, 1e-4),(-1e-4, 1e-4))
c.show()

For some stupid reason, the width parameter of pyplot.arrow defaults to 1e-3, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.arrow.html

Suggested fix: set width instead of head_width and head_length here. The head dimensions are set relative to the width parameter.

Alternative: Use annotate instead of arrow as suggested at the very bottom of https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.arrow.html.

Dependency updates

  • Currently using PyUp but it somehow missed its dependency update for December and is quite limited anyway (only Python so will not help with other projects)
  • Snyk has a lot of features (eg. code scanning) but can't get it to make dependency updates other than for security (despite turning on "automatic dependecy update pull requests")
  • GitHub's built-in Dependabot might be good, nice to have everything in GitHub, though maybe not as fully featured as Snyk.
  • Renovate needs some config but I use it for work, probably about the same features as Dependabot #111
    • But it can't support environment markers in the requirements.txt which we currently need to test against Python2: renovatebot/renovate#12727

iterate_to_root does not respect attempt_best

attempt_best is passed to the newton and muller functions but then it only returns the root if

if err < root_tol:
return root

so if the newton or muller functions exited because abs(dx0) < step_tol, but not abs(y) < root_tol then we still would not return the root.

Perhaps newton and muller could return dx0 so that we could return the root if abs(dx0) < step_tol. Maybe worth evaluating if the attempt_best functionality is useful first.

Also an opportunity to resolve

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Clean up find_roots_gen

It's a very long generator with several functions defined within it so hard to read. Might want to be a class with methods instead.

There are also some special cases and adaptive adjustments in the code that are not tested

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.