GithubHelp home page GithubHelp logo

pygad's People

Contributors

berni-r avatar broett avatar mafrigo avatar migelo avatar renovate[bot] avatar romeeld avatar tanofspace avatar

Stargazers

 avatar

Watchers

 avatar  avatar

pygad's Issues

pip editable install broken

Installing via pip install -e . is broken. When importing pygad installed in such a way it is an empty module:

In [1]: import pygad as pg
In [2]: dir(pg)
Out[2]:
['__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__']

As suggested by pypa/setuptools#3548 (comment) we can install pygad as

pip install -e . --config-settings editable_mode=strict

and voila

In [1]: import pygad as pg
In [2]: dir(pg)
Out[2]:
['BallMask',
 'BoxMask',
 'C',
...
 'units',
 'utils',
 'write']

Should this be included in the docs?

UnitError

There is some unit error when plotting the default gas map on newer matplotlib version.

Code to reproduce

import pygad as pg

s = s = pg.Snapshot('snaps/snap_M1196_4x_470', load_double_prec=True)
pg.plotting.image(s.gas)
---------------------------------------------------------------------------
UnitError                                 Traceback (most recent call last)
Cell In[50], line 1
----> 1 pg.plotting.image(s.gas)

File [/workspaces/pygad/pygad/plotting/maps.py:542](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/pygad/pygad/plotting/maps.py:542), in image(s, qty, av, units, logscale, surface_dens, field, reduction, extent, Npx, xaxis, yaxis, vlim, cmap, normcmaplum, desat, colors, colors_av, cunits, clogscale, csurf_dens, clim, ax, showcbar, cbartitle, scaleind, scaleunits, fontcolor, fontsize, outline, im_alpha, interpolation, maps, zero_is_white, **kwargs)
    539         cbartitle = r'$\log_{10}$(' + cbartitle + ')'
    540     cbartitle = cbartitle.strip()
--> 542 return plot_map(im_lum, colors=im_col,
    543                 extent=extent, vlim=vlim, clim=clim,
    544                 logscale=logscale, clogscale=clogscale,
    545                 units=units, cunits=cunits,
    546                 surface_dens=surface_dens, csurf_dens=csurf_dens,
    547                 cmap=cmap, normcmaplum=normcmaplum, desat=desat,
    548                 ax=ax, showcbar=showcbar, cbartitle=cbartitle,
    549                 scaleind=scaleind, scaleunits=scaleunits,
    550                 fontcolor=fontcolor, fontsize=fontsize, outline=outline,
    551                 im_alpha=im_alpha, xaxis=xaxis, yaxis=yaxis, subs=s,
    552                 interpolation=interpolation, zero_is_white=zero_is_white)

File [/workspaces/pygad/pygad/plotting/maps.py:178](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/pygad/pygad/plotting/maps.py:178), in plot_map(m, colors, extent, vlim, clim, logscale, clogscale, units, cunits, surface_dens, csurf_dens, cmap, normcmaplum, desat, ax, showcbar, cbartitle, scaleind, scaleunits, fontcolor, fontsize, outline, im_alpha, xaxis, yaxis, subs, interpolation, maps, zero_is_white)
    176         clim = clim.in_units_of(cunits)
    177 if clim is None:
--> 178     clim = np.percentile(colors[np.isfinite(colors)], [0.1,99.99])
    179 if clogscale:
    180     colors = np.log10(colors)

File <__array_function__ internals>:180, in percentile(*args, **kwargs)

File [~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4134](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4134), in percentile(a, q, axis, out, overwrite_input, method, keepdims, interpolation)
   4132 if not _quantile_is_valid(q):
   4133     raise ValueError("Percentiles must be in the range [0, 100]")
-> 4134 return _quantile_unchecked(
   4135     a, q, axis, out, overwrite_input, method, keepdims)

File [~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4383](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4383), in _quantile_unchecked(a, q, axis, out, overwrite_input, method, keepdims)
   4375 def _quantile_unchecked(a,
   4376                         q,
   4377                         axis=None,
   (...)
   4380                         method="linear",
   4381                         keepdims=False):
   4382     """Assumes that q is in [0, 1], and is an ndarray"""
-> 4383     r, k = _ureduce(a,
   4384                     func=_quantile_ureduce_func,
   4385                     q=q,
   4386                     axis=axis,
   4387                     out=out,
   4388                     overwrite_input=overwrite_input,
   4389                     method=method)
   4390     if keepdims:
   4391         return r.reshape(q.shape + k)

File [~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:3702](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:3702), in _ureduce(a, func, **kwargs)
   3699 else:
   3700     keepdim = (1,) * a.ndim
-> 3702 r = func(a, **kwargs)
   3703 return r, keepdim

File [~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4552](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4552), in _quantile_ureduce_func(a, q, axis, out, overwrite_input, method)
   4550     else:
   4551         arr = a.copy()
-> 4552 result = _quantile(arr,
   4553                    quantiles=q,
   4554                    axis=axis,
   4555                    method=method,
   4556                    out=out)
   4557 return result

File [~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4669](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4669), in _quantile(arr, quantiles, axis, method, out)
   4667     result_shape = virtual_indexes.shape + (1,) * (arr.ndim - 1)
   4668     gamma = gamma.reshape(result_shape)
-> 4669     result = _lerp(previous,
   4670                    next,
   4671                    gamma,
   4672                    out=out)
   4673 if np.any(slices_having_nans):
   4674     if result.ndim == 0 and out is None:
   4675         # can't write to a scalar

File [~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4488](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/~/.local/lib/python3.10/site-packages/numpy/lib/function_base.py:4488), in _lerp(a, b, t, out)
   4486 diff_b_a = subtract(b, a)
   4487 # asanyarray is a stop-gap until gh-13105
-> 4488 lerp_interpolation = asanyarray(add(a, diff_b_a * t, out=out))
   4489 subtract(b, diff_b_a * (1 - t), out=lerp_interpolation, where=t >= 0.5)
   4490 if lerp_interpolation.ndim == 0 and out is None:

File [/workspaces/pygad/pygad/binning/core.py:300](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/pygad/pygad/binning/core.py:300), in Map.__array_wrap__(self, array, context)
    299 def __array_wrap__(self, array, context=None):
--> 300     return UnitArr.__array_wrap__(self, array, context)

File [/workspaces/pygad/pygad/units/unit_arr.py:325](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/pygad/pygad/units/unit_arr.py:325), in UnitArr.__array_wrap__(self, array, context)
    323 try:
    324     ufunc = context[0]
--> 325     units = UnitArr._ufunc_registry[ufunc](*context[1])
    326     if units is not None:
    327         units = units.gather()

File [/workspaces/pygad/pygad/units/unit_arr.py:784](https://vscode-remote+codespaces-002bmigelo-002dliterate-002drobot-002dv7vprrwqr5hwq95.vscode-resource.vscode-cdn.net/workspaces/pygad/pygad/units/unit_arr.py:784), in _same_units_binary(a, b)
    782     else:
    783         a_units.in_units_of(b_units)
--> 784         raise units.UnitError('Units are not the same but they are ' +
    785                               'convertable. Use operator instead of ' +
    786                               'function or convert manually.')
    787 else:
    788     return a_units if a_units is not None else b_units

UnitError: 'Units are not the same but they are convertable. Use operator instead of function or convert manually.'

Dependency Dashboard

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

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Lock file maintenance

Open

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

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • python 3.11-slim-buster
github-actions
.github/workflows/workflow.yml
  • actions/checkout v4
  • actions/setup-python v5
pep621
pyproject.toml
setup-cfg
setup.cfg
  • numpy <1.25
  • matplotlib !=3.7.2,<3.9.0
  • astropy <=6.0.0
  • scipy <=1.12.0
  • h5py <=3.10.0
  • Pillow <=10.2.0

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

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.