gzenhaeusern / polarisation-package

GNU General Public License v3.0
3 stars 0 forks source link

Error trying to reproduce examples #1

Open bosby74 opened 1 week ago

bosby74 commented 1 week ago

Dear, I'm trying to use your code to reproduce some results you presented in the paper "Locating the Nordstream explosions using polarization analysis". In particular, I would calculate the baz for event 2A and station DK.BSD. If I try to get the information without plotting the results the code is working well getting as result:

'Back azimuth: 52 deg; uncertainty: 37-66 deg'

but when I try to produce the plots (adding -p option) I get this error:

'Processing waveforms... Polarisation analysis... Traceback (most recent call last): File "/home/simone/tmp/test-polarization_analysis/gzenhaeusern-polarisation-package-ec2e99d/polarisation_package/polarisation_main.py", line 90, in polarisation(st, args.arg_plot, args.arg_event_name) File "/home/simone/tmp/test-polarization_analysis/gzenhaeusern-polarisation-package-ec2e99d/polarisation_package/polarisation_main.py", line 52, in polarisation ppl.plot_polarization_event_noise(st, File "/home/simone/tmp/test-polarization_analysis/gzenhaeusern-polarisation-package-ec2e99d/polarisation_package/polarisation_plot.py", line 306, in plot_polarization_event_noise cm = polarization.pcolormesh_alpha(ax, t_datetime, f, data, File "/home/simone/tmp/test-polarization_analysis/gzenhaeusern-polarisation-package-ec2e99d/polarisation_package/polarisation_calculation.py", line 194, in pcolormesh_alpha colors[:, -1] = alpha[:len(y)-1, :len(x)-1].ravel() ValueError: could not broadcast input array from shape (891000,) into shape (99,4)'

and the run is broken. Have you an idea about what is this error? and how I can correct it?

Thank you in advance, Simone

gzenhaeusern commented 5 days ago

Hi,

I can't reproduce the error, unfortunately. Did you change something with the frequency range or window lengths, or do some pre-filtering that does not match the frequency range in the plots?

Géraldine

bosby74 commented 5 days ago

Hi Geraldine, I didn't change anything in the script I downloaded from this repository. I suppose the problem is related to conflicting versions of some packages (as already commented here) because trying it in an older conda environment works correctly. In my case, the code works with these packages which are probably not all needed to run the code:

# packages in environment at /home/simone/anaconda3/envs/work:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
aiohappyeyeballs          2.4.3                    pypi_0    pypi
aiohttp                   3.10.10                  pypi_0    pypi
aiosignal                 1.3.1                    pypi_0    pypi
alabaster                 1.0.0                    pypi_0    pypi
anyio                     3.6.2              pyhd8ed1ab_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py311hd4cff14_3    conda-forge
arrow                     1.3.0                    pypi_0    pypi
astroid                   3.3.5                    pypi_0    pypi
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
asyncssh                  2.18.0                   pypi_0    pypi
atomicwrites              1.4.1                    pypi_0    pypi
attrs                     22.2.0             pyh71513ae_0    conda-forge
autopep8                  2.0.4                    pypi_0    pypi
babel                     2.16.0                   pypi_0    pypi
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports-tarfile         1.2.0                    pypi_0    pypi
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.11.1             pyha770c72_0    conda-forge
binaryornot               0.4.4                    pypi_0    pypi
black                     24.10.0                  pypi_0    pypi
bleach                    6.0.0              pyhd8ed1ab_0    conda-forge
brotli                    1.0.9                h166bdaf_8    conda-forge
brotli-bin                1.0.9                h166bdaf_8    conda-forge
brotlipy                  0.7.0           py311hd4cff14_1005    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2023.12.12           h06a4308_0  
certifi                   2023.11.17      py311h06a4308_0  
cffi                      1.15.1          py311h409f033_3    conda-forge
chardet                   5.2.0                    pypi_0    pypi
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
click                     8.1.7                    pypi_0    pypi
cloudpickle               3.1.0                    pypi_0    pypi
comm                      0.1.2              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.7           py311ha3edf6b_0    conda-forge
cookiecutter              2.6.0                    pypi_0    pypi
cryptography              39.0.0          py311h9b4c7bb_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cython                    3.0.11                   pypi_0    pypi
debugpy                   1.6.6           py311hcafe171_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
deprecated                1.2.14                   pypi_0    pypi
diff-match-patch          20241021                 pypi_0    pypi
dill                      0.3.9                    pypi_0    pypi
docstring-to-markdown     0.15                     pypi_0    pypi
docutils                  0.21.2                   pypi_0    pypi
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
flake8                    7.1.1                    pypi_0    pypi
flit-core                 3.8.0              pyhd8ed1ab_0    conda-forge
fonttools                 4.38.0          py311hd4cff14_1    conda-forge
fqdn                      1.5.1                    pypi_0    pypi
freetype                  2.12.1               hca18f0e_1    conda-forge
frozenlist                1.5.0                    pypi_0    pypi
greenlet                  2.0.1           py311ha362b79_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
imagesize                 1.4.1                    pypi_0    pypi
importlib-metadata        8.5.0                    pypi_0    pypi
importlib_resources       5.10.2             pyhd8ed1ab_0    conda-forge
inflection                0.5.1                    pypi_0    pypi
intervaltree              3.1.0                    pypi_0    pypi
ipykernel                 6.29.5                   pypi_0    pypi
ipython                   8.29.0                   pypi_0    pypi
ipython_genutils          0.2.0                      py_1    conda-forge
isoduration               20.11.0                  pypi_0    pypi
isort                     5.13.2                   pypi_0    pypi
jaraco-classes            3.4.0                    pypi_0    pypi
jaraco-context            6.0.1                    pypi_0    pypi
jaraco-functools          4.1.0                    pypi_0    pypi
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jeepney                   0.8.0                    pypi_0    pypi
jellyfish                 1.1.0                    pypi_0    pypi
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.2.0           py311h06a4308_0  
jpeg                      9e                   h166bdaf_2    conda-forge
json5                     0.9.5              pyh9f0ad1d_0    conda-forge
jsonpointer               3.0.0                    pypi_0    pypi
jsonschema                4.23.0                   pypi_0    pypi
jsonschema-specifications 2024.10.1                pypi_0    pypi
jupyter-events            0.10.0                   pypi_0    pypi
jupyter-server            2.14.2                   pypi_0    pypi
jupyter_client            7.4.9              pyhd8ed1ab_0    conda-forge
jupyter_core              5.1.5           py311h38be061_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
keyring                   25.5.0                   pypi_0    pypi
kiwisolver                1.4.4           py311h4dd048b_1    conda-forge
lcms2                     2.14                 hfd0df8a_1    conda-forge
ld_impl_linux-64          2.39                 hcc3a1bd_1    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libblas                   3.9.0           16_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h166bdaf_8    conda-forge
libbrotlidec              1.0.9                h166bdaf_8    conda-forge
libbrotlienc              1.0.9                h166bdaf_8    conda-forge
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libdeflate                1.17                 h0b41bf4_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgfortran-ng            12.2.0              h69a702a_19    conda-forge
libgfortran5              12.2.0              h337968e_19    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libjpeg-turbo             2.1.4                h166bdaf_0    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.21          pthreads_h78a6416_3    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libtiff                   4.5.0                h6adf6a1_2    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libwebp-base              1.2.4                h166bdaf_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxml2                   2.10.3               h7463322_0    conda-forge
libxslt                   1.1.37               h873f0b0_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
lxml                      4.9.2           py311h14a6109_0    conda-forge
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.2           py311h2582759_0    conda-forge
matplotlib-base           3.6.3           py311h8597a09_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mccabe                    0.7.0                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
mistune                   2.0.4              pyhd8ed1ab_0    conda-forge
more-itertools            10.5.0                   pypi_0    pypi
mpmath                    1.3.0                    pypi_0    pypi
multidict                 6.1.0                    pypi_0    pypi
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mypy-extensions           1.0.0                    pypi_0    pypi
nbclassic                 0.4.8              pyhd8ed1ab_0    conda-forge
nbclient                  0.7.2              pyhd8ed1ab_0    conda-forge
nbconvert                 7.2.9              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.2.9              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.2.9              pyhd8ed1ab_0    conda-forge
nbformat                  5.7.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
notebook-shim             0.2.2              pyhd8ed1ab_0    conda-forge
numpy                     1.24.1          py311hbde0eaa_0    conda-forge
numpydoc                  1.8.0                    pypi_0    pypi
obspy                     1.4.0           py311hcb2cf0a_2    conda-forge
openjpeg                  2.5.0                hfec8fc6_2    conda-forge
openssl                   3.0.12               h7f8727e_0  
overrides                 7.7.0                    pypi_0    pypi
packaging                 24.2                     pypi_0    pypi
pandas                    2.2.3                    pypi_0    pypi
pandoc                    2.19.2               h32600fe_1    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pathspec                  0.12.1                   pypi_0    pypi
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.4.0           py311h104bd61_0    conda-forge
pip                       24.3.1                   pypi_0    pypi
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
platformdirs              4.3.6                    pypi_0    pypi
pluggy                    1.5.0                    pypi_0    pypi
pooch                     1.6.0              pyhd8ed1ab_0    conda-forge
prometheus_client         0.16.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.48                   pypi_0    pypi
propcache                 0.2.0                    pypi_0    pypi
psutil                    5.9.4           py311hd4cff14_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pycodestyle               2.12.1                   pypi_0    pypi
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydocstyle                6.3.0                    pypi_0    pypi
pydot                     1.2.4                      py_0    conda-forge
pyflakes                  3.2.0                    pypi_0    pypi
pygithub                  2.5.0                    pypi_0    pypi
pygments                  2.18.0                   pypi_0    pypi
pyjwt                     2.9.0                    pypi_0    pypi
pylint                    3.3.1                    pypi_0    pypi
pylint-venv               3.0.4                    pypi_0    pypi
pyls-spyder               0.4.0                    pypi_0    pypi
pynacl                    1.5.0                    pypi_0    pypi
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyqt5                     5.15.11                  pypi_0    pypi
pyqt5-qt5                 5.15.15                  pypi_0    pypi
pyqt5-sip                 12.15.0                  pypi_0    pypi
pyqtwebengine             5.15.7                   pypi_0    pypi
pyqtwebengine-qt5         5.15.15                  pypi_0    pypi
pyrsistent                0.19.3          py311h2582759_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.0          he550d4f_1_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.16.2             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.4              pyhd8ed1ab_0    conda-forge
python-lsp-black          2.0.0                    pypi_0    pypi
python-lsp-jsonrpc        1.1.2                    pypi_0    pypi
python-lsp-server         1.12.0                   pypi_0    pypi
python-slugify            8.0.4                    pypi_0    pypi
python-wget               3.2                        py_0    conda-forge
python_abi                3.11                    3_cp311    conda-forge
pytoolconfig              1.3.1                    pypi_0    pypi
pytz                      2022.7.1           pyhd8ed1ab_0    conda-forge
pyuca                     1.2                      pypi_0    pypi
pyxdg                     0.28                     pypi_0    pypi
pyyaml                    6.0             py311hd4cff14_5    conda-forge
pyzmq                     25.0.0          py311hd6ccaeb_0    conda-forge
qdarkstyle                3.2.3                    pypi_0    pypi
qstylizer                 0.2.3                    pypi_0    pypi
qtawesome                 1.3.1                    pypi_0    pypi
qtconsole                 5.6.1                    pypi_0    pypi
qtpy                      2.4.2                    pypi_0    pypi
readline                  8.1.2                h0f457ee_0    conda-forge
referencing               0.35.1                   pypi_0    pypi
requests                  2.32.3                   pypi_0    pypi
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rich                      13.9.4                   pypi_0    pypi
rope                      1.13.0                   pypi_0    pypi
rpds-py                   0.21.0                   pypi_0    pypi
rtree                     1.3.0                    pypi_0    pypi
scikit-learn              1.3.0           py311ha02d727_0    anaconda
scipy                     1.10.0          py311h8e6699e_0    conda-forge
seaborn                   0.13.2                   pypi_0    pypi
secretstorage             3.3.3                    pypi_0    pypi
send2trash                1.8.3                    pypi_0    pypi
setuptools                66.1.1             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
snowballstemmer           2.2.0                    pypi_0    pypi
sortedcontainers          2.4.0                    pypi_0    pypi
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
sphinx                    8.1.3                    pypi_0    pypi
sphinxcontrib-applehelp   2.0.0                    pypi_0    pypi
sphinxcontrib-devhelp     2.0.0                    pypi_0    pypi
sphinxcontrib-htmlhelp    2.1.0                    pypi_0    pypi
sphinxcontrib-jsmath      1.0.1                    pypi_0    pypi
sphinxcontrib-qthelp      2.0.0                    pypi_0    pypi
sphinxcontrib-serializinghtml 2.0.0                    pypi_0    pypi
spyder                    6.0.2                    pypi_0    pypi
spyder-kernels            3.0.1                    pypi_0    pypi
sqlalchemy                1.4.46          py311h2582759_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
superqt                   0.6.7                    pypi_0    pypi
sympy                     1.13.3                   pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
terminado                 0.17.1             pyh41d4057_0    conda-forge
text-unidecode            1.3                      pypi_0    pypi
textdistance              4.6.3                    pypi_0    pypi
threadpoolctl             2.2.0              pyh0d69192_0  
three-merge               0.1.1                    pypi_0    pypi
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tomlkit                   0.13.2                   pypi_0    pypi
tornado                   6.2             py311hd4cff14_1    conda-forge
traitlets                 5.14.3                   pypi_0    pypi
types-python-dateutil     2.9.0.20241003           pypi_0    pypi
typing-extensions         4.12.2                   pypi_0    pypi
tzdata                    2024.2                   pypi_0    pypi
ujson                     5.10.0                   pypi_0    pypi
uri-template              1.3.0                    pypi_0    pypi
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
watchdog                  6.0.0                    pypi_0    pypi
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
webcolors                 24.11.1                  pypi_0    pypi
webencodings              0.5.1                      py_1    conda-forge
websocket-client          1.8.0                    pypi_0    pypi
whatthepatch              1.0.6                    pypi_0    pypi
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
wrapt                     1.16.0                   pypi_0    pypi
wurlitzer                 3.1.1                    pypi_0    pypi
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yapf                      0.40.2                   pypi_0    pypi
yarl                      1.17.1                   pypi_0    pypi
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.21.0                   pypi_0    pypi
zstd                      1.5.2                h3eb15da_6    conda-forge 

Since maintaining the code is a time-consuming process, you might think about solutions like packaged versions so that the code is as portable as possible.

Simone