morganjwilliams / pyrolite

A set of tools for getting the most from your geochemical data.
https://pyrolite.readthedocs.io
Other
133 stars 37 forks source link

New to Pyrolite and having trouble to make pyroplot .scatter work as per tutorials[FEATURE] #101

Closed mbastosf64 closed 2 weeks ago

mbastosf64 commented 9 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Relevant References Any references related to the above-mentioned feature or issue.

mbastosf64 commented 9 months ago

error below 2024-01-31 16:02:27,503 [7796] WARNING py.warnings:109: [JupyterRequire] :228: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility. Expected 56 from C header, got 64 from PyObject


AttributeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_7796/3051707880.py in 5 import pandas as pd 6 import mpltern as mpl ----> 7 from pyrolite.util.synthetic import normal_frame

~\Anaconda3\lib\site-packages\pyrolite\util\synthetic.py in 6 7 from ..comp.codata import ILR, inverse_ILR ----> 8 from ..geochem.ind import REE, get_ionic_radii 9 from ..geochem.norm import get_reference_composition 10 from ..util.lambdas.eval import get_function_components

~\Anaconda3\lib\site-packages\pyrolite\geochem__init__.py in 8 from ..util.log import Handle 9 from ..util.meta import update_docstring_references ---> 10 from . import norm, parse, transform 11 from .ind import REE, REY, _common_elements, _common_oxides 12 from .ions import set_default_ionic_charges

~\Anaconda3\lib\site-packages\pyrolite\geochem\transform.py in 7 8 from ..comp.codata import close, renormalise ----> 9 from ..util import lambdas 10 from ..util.log import Handle 11 from ..util.meta import update_docstring_references

~\Anaconda3\lib\site-packages\pyrolite\util\lambdas__init__.py in 9 from .opt import lambdas_optimize 10 from .params import _get_params, orthogonal_polynomial_constants ---> 11 from .plot import plot_lambdas_components, plot_profiles 12 from .transform import REE_z_to_radii 13

~\Anaconda3\lib\site-packages\pyrolite\util\lambdas\plot.py in 6 import numpy as np 7 ----> 8 from ... import plot 9 from ...geochem.ind import REE, get_ionic_radii 10 from ..log import Handle

~\Anaconda3\lib\site-packages\pyrolite\plot__init__.py in 21 from ..util.plot.helpers import plot_cooccurence 22 from ..util.plot.style import _export_nonRCstyles, linekwargs, scatterkwargs ---> 23 from . import density, parallel, spider, stem 24 from .color import process_color 25

~\Anaconda3\lib\site-packages\pyrolite\plot\density__init__.py in 12 from ...util.meta import get_additional_params, subkwargs 13 from ...util.plot.axes import add_colorbar, init_axes ---> 14 from ...util.plot.density import ( 15 get_axis_density_methods, 16 percentile_contour_values_from_meshz,

~\Anaconda3\lib\site-packages\pyrolite\util\plot\density.py in 22 23 try: ---> 24 import statsmodels.api as sm 25 26 HAVE_SM = True

~\Anaconda3\lib\site-packages\statsmodels\api.py in 7 from . import tools 8 from .tools.tools import add_constant, categorical ----> 9 from . import regression 10 from .regression.linear_model import OLS, GLS, WLS, GLSAR 11 from .regression.recursive_ls import RecursiveLS

~\Anaconda3\lib\site-packages\statsmodels\regression__init__.py in ----> 1 from .linear_model import yule_walker 2 3 from statsmodels.tools._testing import PytestTester 4 5 all = ['yule_walker', 'test']

~\Anaconda3\lib\site-packages\statsmodels\regression\linear_model.py in 44 from statsmodels.tools.decorators import (cache_readonly, 45 cache_writable) ---> 46 import statsmodels.base.model as base 47 import statsmodels.base.wrapper as wrap 48 from statsmodels.emplike.elregress import _ELRegOpts

~\Anaconda3\lib\site-packages\statsmodels\base\model.py in 14 cached_value, cached_data) 15 import statsmodels.base.wrapper as wrap ---> 16 from statsmodels.tools.numdiff import approx_fprime 17 from statsmodels.tools.sm_exceptions import ValueWarning, \ 18 HessianInversionWarning

~\Anaconda3\lib\site-packages\statsmodels\tools\numdiff.py in 49 50 # NOTE: we only do double precision internally so far ---> 51 EPS = np.MachAr().eps 52 53 _hessian_docs = """

~\Anaconda3\lib\site-packages\numpy__init.py in getattr(attr) 360 raise RuntimeError("Tester was removed in NumPy 1.25.") 361 --> 362 raise AttributeError("module {!r} has no attribute " 363 "{!r}".format(name__, attr)) 364

AttributeError: module 'numpy' has no attribute 'MachAr'

mbastosf64 commented 9 months ago

uisng the latest numpy version, tried to downgrade but still getting this error and the one below , any suggestions.


AttributeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_20640/260713670.py in ----> 1 df[['MgO','Al2O3','CaO']].pyroplot.scatter(color='k', alpha=0.5)

~\Anaconda3\lib\site-packages\pandas\core\generic.py in getattr(self, name) 5573 ): 5574 return self[name] -> 5575 return object.getattribute(self, name) 5576 5577 def setattr(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'pyroplot

morganjwilliams commented 9 months ago

Hey @mbastosf64! Apologies I didn't manage to get back to you last week, the first one I'm unsure about (it does seem to be a statsmodels-numpy version conflict or similar..), but the second one will hopefully be resolved with an added import:

import pyrolite.plot
mbastosf64 commented 9 months ago

thank you for the reply my numpy is 1.26.3 which version shall i downgrade to make it work - pyrolite?

On Sun, Feb 4, 2024 at 3:31 PM Morgan Williams @.***> wrote:

Hey @mbastosf64 https://github.com/mbastosf64! Apologies I didn't manage to get back to you last week, the first one I'm unsure about (it does seem to be a statsmodels-numpy version conflict or similar..), but the second one will hopefully be resolved with an added import:

import pyrolite.plot

— Reply to this email directly, view it on GitHub https://github.com/morganjwilliams/pyrolite/issues/101#issuecomment-1925975561, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFYKMAAZ2TS4GHOMUPWOU5DYSAK3JAVCNFSM6AAAAABCT6IBEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVHE3TKNJWGE . You are receiving this because you were mentioned.Message ID: @.***>

morganjwilliams commented 9 months ago

@mbastosf64 it should work with 1.24, if you're still having issues. But it looks like the error relates to a numpy deprecation (since about numpy v1.22), which I think should have been fixed in statsmodels>=0.15.