Skip to content

pygtide.results() fails #37

@ahellers

Description

@ahellers

Hi,

first things first: I appreciate your worke since I was looking for a "Python version" of ETERNA/Predict for a longer time. Thanks!

However, I just encountered the following problem/bug when running the test after installing pygtide 0.7.1 via pip:

pygtide.test(msg=True)
ETERNA PREDICT v3.4 (10/02/2013) is calculating, please wait ...
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/hellerschmied/pyProjects/pygtide-test/env/lib/python3.9/site-packages/pygtide/tests.py", line 11, in test
    pt.results()
  File "/home/hellerschmied/pyProjects/pygtide-test/env/lib/python3.9/site-packages/pygtide/core.py", line 403, in results
    etdata[cols[2:]] = np.around(etpred_data[:, 2:], digits)
  File "/home/hellerschmied/pyProjects/pygtide-test/env/lib/python3.9/site-packages/pandas/core/frame.py", line 3946, in __setitem__
    self._setitem_frame(key, value)
  File "/home/hellerschmied/pyProjects/pygtide-test/env/lib/python3.9/site-packages/pandas/core/frame.py", line 4058, in _setitem_frame
    raise ValueError("Array conditional must be same shape as self")
ValueError: Array conditional must be same shape as self

I think, I found the problem in core.py line 388: cols = np.char.strip(etpred.inout.header.astype('str')):
etpred.inout.header.astype('str') returns a 6x25 array, although it should only be a one-dimensional array containing the 6 header names for the predict output. This array is used to create the DataFrame with more than 100 columns instead of 6 to store the predict results. In line 403 the program crashes when assigning 4 rows with results to the incorrectly initialized DataFrame.

pygtide.predict_series() seems to work fine as the results() method is not used.

I can reproduce this error with the gfortran compiler on Ubuntu 22.04 and CentOS 8 with Python3.9 and Python3.8. I don'T know if this issues depends on the gfortran compiler, or other parameters.

Does anyone encounter similar problems?

Best regards,
Andreas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions