Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError in PolyChordLite example script #276

Open
NiallJeffrey opened this issue Mar 27, 2023 · 1 comment
Open

AttributeError in PolyChordLite example script #276

NiallJeffrey opened this issue Mar 27, 2023 · 1 comment
Milestone

Comments

@NiallJeffrey
Copy link

Having installed PolyChordLite (https://github.com/PolyChord/PolyChordLite), I ran the example script (https://github.com/PolyChord/PolyChordLite/blob/master/run_pypolychord.py).

PolyChord ran fine, but the Anesthetic plotter failed.

Error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[9], line 4
      2     from anesthetic import NestedSamples
      3     samples = NestedSamples(root= settings.base_dir + '/' + settings.file_root)
----> 4     fig, axes = samples.plot_2d(['p0','p1','p2','p3','r'])
      5     fig.savefig('posterior.pdf')
      7 except ImportError:

File ~/.conda/envs/polychordenv/lib/python3.9/site-packages/anesthetic/samples.py:351, in MCMCSamples.plot_2d(self, axes, *args, **kwargs)
    348     local_kwargs[pos].update(kwargs)
    350 if not isinstance(axes, pandas.DataFrame):
--> 351     fig, axes = make_2d_axes(axes, tex=self.tex,
    352                              upper=('upper' in types),
    353                              lower=('lower' in types),
    354                              diagonal=('diagonal' in types))
    355 else:
    356     fig = axes.values[~axes.isna()][0].figure

File ~/.conda/envs/polychordenv/lib/python3.9/site-packages/anesthetic/plot.py:200, in make_2d_axes(params, **kwargs)
    198 axes[x][y].twin.set_ylim(0, 1.1)
    199 axes[x][y].set_zorder(axes[x][y].twin.get_zorder() + 1)
--> 200 axes[x][y].lines = axes[x][y].twin.lines
    201 axes[x][y].patches = axes[x][y].twin.patches
    202 axes[x][y].collections = axes[x][y].twin.collections

AttributeError: can't set attribute

My environment details:

# packages in environment at /global/homes/u/ucapnje/.conda/envs/polychordenv:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
anesthetic                1.3.6                    pypi_0    pypi
asttokens                 2.0.5              pyhd3eb1b0_0  
backcall                  0.2.0              pyhd3eb1b0_0  
blas                      1.0                         mkl  
brotli                    1.0.9                h5eee18b_7  
brotli-bin                1.0.9                h5eee18b_7  
ca-certificates           2023.01.10           h06a4308_0  
certifi                   2022.12.7        py39h06a4308_0  
comm                      0.1.2            py39h06a4308_0  
contourpy                 1.0.5            py39hdb19cb5_0  
cycler                    0.11.0             pyhd3eb1b0_0  
dbus                      1.13.18              hb2f20db_0  
debugpy                   1.5.1            py39h295c915_0  
decorator                 5.1.1              pyhd3eb1b0_0  
entrypoints               0.4              py39h06a4308_0  
executing                 0.8.3              pyhd3eb1b0_0  
expat                     2.4.9                h6a678d5_0  
fftw                      3.3.9                h27cfd23_1  
fontconfig                2.14.1               h52c9d5c_1  
fonttools                 4.25.0             pyhd3eb1b0_0  
freetype                  2.12.1               h4a9f257_0  
getdist                   1.4.2                    pypi_0    pypi
giflib                    5.2.1                h7b6447c_0  
glib                      2.69.1               he621ea3_2  
gst-plugins-base          1.14.0               h8213a91_2  
gstreamer                 1.14.0               h28cd5cc_2  
icu                       58.2                 he6710b0_3  
intel-openmp              2021.4.0          h06a4308_3561  
ipykernel                 6.19.2           py39hb070fc8_0  
ipython                   8.10.0           py39h06a4308_0  
jedi                      0.18.1           py39h06a4308_1  
jpeg                      9e                   h7f8727e_0  
jupyter_client            7.4.9            py39h06a4308_0  
jupyter_core              5.2.0            py39h06a4308_0  
kiwisolver                1.4.4            py39h6a678d5_0  
krb5                      1.19.4               h568e23c_0  
lcms2                     2.12                 h3be6417_0  
ld_impl_linux-64          2.38                 h1181459_1  
lerc                      3.0                  h295c915_0  
libbrotlicommon           1.0.9                h5eee18b_7  
libbrotlidec              1.0.9                h5eee18b_7  
libbrotlienc              1.0.9                h5eee18b_7  
libclang                  10.0.1          default_hb85057a_2  
libdeflate                1.8                  h7f8727e_5  
libedit                   3.1.20221030         h5eee18b_0  
libevent                  2.1.12               h8f2d780_0  
libffi                    3.4.2                h6a678d5_6  
libgcc-ng                 11.2.0               h1234567_1  
libgfortran-ng            11.2.0               h00389a5_1  
libgfortran5              11.2.0               h1234567_1  
libgomp                   11.2.0               h1234567_1  
libllvm10                 10.0.1               hbcb73fb_5  
libpng                    1.6.37               hbc83047_0  
libpq                     12.9                 h16c4e8d_3  
libsodium                 1.0.18               h7b6447c_0  
libstdcxx-ng              11.2.0               h1234567_1  
libtiff                   4.5.0                hecacb30_0  
libuuid                   1.41.5               h5eee18b_0  
libwebp                   1.2.4                h11a3e52_0  
libwebp-base              1.2.4                h5eee18b_0  
libxcb                    1.15                 h7f8727e_0  
libxkbcommon              1.0.1                hfa300c1_0  
libxml2                   2.9.14               h74e7548_0  
libxslt                   1.1.35               h4e12654_0  
lz4-c                     1.9.4                h6a678d5_0  
matplotlib                3.6.2            py39h06a4308_0  
matplotlib-base           3.6.2            py39h945d387_0  
matplotlib-inline         0.1.6            py39h06a4308_0  
mkl                       2021.4.0           h06a4308_640  
mkl-service               2.4.0            py39h7f8727e_0  
mkl_fft                   1.3.1            py39hd3c417c_0  
mkl_random                1.2.2            py39h51133e4_0  
mpi4py                    3.1.4                    pypi_0    pypi
munkres                   1.1.4                      py_0  
ncurses                   6.3                  h5eee18b_3  
nest-asyncio              1.5.6            py39h06a4308_0  
nspr                      4.33                 h295c915_0  
nss                       3.74                 h0370c37_0  
numpy                     1.23.5           py39h14f4228_0  
numpy-base                1.23.5           py39h31eccc5_0  
openssl                   1.1.1t               h7f8727e_0  
packaging                 22.0             py39h06a4308_0  
pandas                    1.0.5                    pypi_0    pypi
parso                     0.8.3              pyhd3eb1b0_0  
pcre                      8.45                 h295c915_0  
pexpect                   4.8.0              pyhd3eb1b0_3  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pillow                    9.3.0            py39hace64e9_1  
pip                       22.3.1           py39h06a4308_0  
platformdirs              2.5.2            py39h06a4308_0  
ply                       3.11             py39h06a4308_0  
prompt-toolkit            3.0.36           py39h06a4308_0  
psutil                    5.9.0            py39h5eee18b_0  
ptyprocess                0.7.0              pyhd3eb1b0_2  
pure_eval                 0.2.2              pyhd3eb1b0_0  
pygments                  2.11.2             pyhd3eb1b0_0  
pyparsing                 3.0.9            py39h06a4308_0  
pypolychord               1.20.1                   pypi_0    pypi
pyqt                      5.15.7           py39h6a678d5_1  
pyqt5-sip                 12.11.0          py39h6a678d5_1  
python                    3.9.16               h7a1cb2a_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
pytz                      2023.2                   pypi_0    pypi
pyyaml                    6.0                      pypi_0    pypi
pyzmq                     23.2.0           py39h6a678d5_0  
qt-main                   5.15.2               h327a75a_7  
qt-webengine              5.15.9               hd2b0992_4  
qtwebkit                  5.212                h4eab89a_4  
readline                  8.2                  h5eee18b_0  
scipy                     1.9.3            py39h14f4228_0  
setuptools                65.6.3           py39h06a4308_0  
sip                       6.6.2            py39h6a678d5_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.40.1               h5082296_0  
stack_data                0.2.0              pyhd3eb1b0_0  
tk                        8.6.12               h1ccaba5_0  
toml                      0.10.2             pyhd3eb1b0_0  
tornado                   6.2              py39h5eee18b_0  
traitlets                 5.7.1            py39h06a4308_0  
tzdata                    2022g                h04d1e81_0  
wcwidth                   0.2.5              pyhd3eb1b0_0  
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.10               h5eee18b_1  
zeromq                    4.3.4                h2531618_0  
zlib                      1.2.13               h5eee18b_0  
zstd                      1.5.2                ha4553b6_0  
@lukashergt
Copy link
Collaborator

Hi @NiallJeffrey,

anesthetic version 1.3.6 is fairly old by now, so my initial guess would be that it might no longer be compatible with newer versions of pandas and/or matplotlib.

We are pushing for the anesthetic 2.0.0 release, which will hopefully happen soon. That will probably also prompt a new PolyChord release.

Until then, I'd probably recommend installing the latest anesthetic 2.0.0 beta version and using the anesthetic plotting script from PolyChord 1.20.2, which has already been updated. But maybe @williamjameshandley has a different recommendation?

@williamjameshandley williamjameshandley added this to the 2.0.1 milestone Jun 15, 2023
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

No branches or pull requests

3 participants