jorge-ramirez-upm / RepTate

RepTate (Rheology of Entangled Polymers: Toolkit for Analysis of Theory & Experiment)
https://reptate.readthedocs.io/
GNU General Public License v3.0
25 stars 7 forks source link

Creep retardation mode #143

Closed vbdr closed 4 years ago

vbdr commented 4 years ago
Error Traceback:
   File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1041, in handle_actionNew_Theory
    self.new_theory(th_name)
  File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1051, in new_theory
    newth = self.do_new(th_name, calculate)
  File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/DataSet.py", line 1264, in do_new
    th.do_calculate("")
  File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 378, in do_calculate
    self.do_error(line)
  File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 480, in do_error
    ~np.isinf(yexp)) * (~np.isinf(xth)) * (~np.isinf(yth))
ValueError: operands could not be broadcast together with shapes (317,1) (325,1) 
vbdr commented 4 years ago

Likely due to the view viewLogStraint that trims negative values from np array: cond = (dt.data[:, 0] > 0) * (dt.data[:, 1] > 0)

jorge-ramirez-upm commented 4 years ago

Hi Victor, There is a small problem here. Let's discuss it briefly to see what's the best thing to do.

So, maybe you're right. I propose the following:

What do you think? Sorry for the long email. Jorge

On Sun, May 24, 2020 at 8:58 AM Victor Boudara notifications@github.com wrote:

  • Open Creep app
  • Load example datafile "CM3_Creep.creep"
  • Open theory "retardation mode" and get this error:

Error Traceback: File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1041, in handle_actionNew_Theory self.new_theory(th_name) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1051, in new_theory newth = self.do_new(th_name, calculate) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/DataSet.py", line 1264, in do_new th.do_calculate("") File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 378, in do_calculate self.do_error(line) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 480, in do_error ~np.isinf(yexp)) (~np.isinf(xth)) (~np.isinf(yth)) ValueError: operands could not be broadcast together with shapes (317,1) (325,1)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jorge-ramirez-upm/RepTate/issues/143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAYQHKTHDEIS5JIWE5K5STRTDAQLANCNFSM4NIYPRXQ .

--

[image: Industriales] ESCUELA SUPERIOR DE INGENIEROS INDUSTRIALES UNIVERSIDAD POLITÉCNICA DE MADRID

vbdr commented 4 years ago

HI Jorge,

Thank you for that. I agree with you proposition to remove the filter instead of adding a layer of complexity to the calculation with an interpolation.

I thought about another thing we could do to meet halfway (filter and keep the same array dimension): set results to np.nan where the input array is negative or zero. Something like this

def viewLogStraint(self, dt, file_parameters):
    """Logarithm of the applied strain :math:`\\gamma(t)` vs logarithm of time :math:`t`"""
    mask = (dt.data[:, 0] > 0) * (dt.data[:, 1] > 0)
    notmask = ~mask
    x = np.empty((dt.num_rows, 1))
    y = np.empty((dt.num_rows, 1))
    x[notmask, 0] = np.nan
    y[notmask, 0] = np.nan
    x[mask, 0] = np.log10(dt.data[mask, 0])
    y[mask, 0] = np.log10(np.abs(dt.data[mask, 1]))
    return x, y, True

What do you think?

Victor

On 24 May 2020, at 12:38, Jorge Ramirez notifications@github.com wrote:

Hi Victor, There is a small problem here. Let's discuss it briefly to see what's the best thing to do.

  • Before filtering the data, we were getting errors whenever there was a log10 of zero or negative numbers. That is why I introduced the filters.
  • The filters, of course give additional problems... Now the theory and the data, according to the view, could have different number of points, because they are being filtered. This is what is happening with that particular creep file. The experimental data has negative strain values (which make no sense). The theory, of course, never gets negative strains. When the experiment and theory are filtered by the view, they end up having different number of points.
  • We could take care of the different number of points in theory and experiment by using interpolation. We already do that in some theories (Likhtman-McLeish and also LVE BoB). That would increase slightly the time for the calculation of the error, which could result in longer minimization times.
  • Of course, we could forget about all the above if we remove the filters. The errors in numpy are sent to the logger, so they won't interrupt the calculation. They will just be shown in the logger window and RepTate.log file. The error value calculated by RepTate will be OK because the output of the View is filtered out of nans and infs.
  • I am not sure what would happen when we load project files. The errors in that case are ignored. I am givint it a try... OK It doesn't show any error.

So, maybe you're right. I propose the following:

  • Remove the filters and hope that all the errors we were getting yesterday when loading project files are not coming back.
  • I would add a seterrcall line to the Application class or the View class. The views belong to the application and it makes sense that, whenever we get a numpy error sent to the logger, the logger shows where the error took place.

What do you think? Sorry for the long email. Jorge

On Sun, May 24, 2020 at 8:58 AM Victor Boudara notifications@github.com wrote:

  • Open Creep app
  • Load example datafile "CM3_Creep.creep"
  • Open theory "retardation mode" and get this error:

Error Traceback: File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1041, in handle_actionNew_Theory self.new_theory(th_name) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1051, in new_theory newth = self.do_new(th_name, calculate) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/DataSet.py", line 1264, in do_new th.do_calculate("") File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 378, in do_calculate self.do_error(line) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 480, in do_error ~np.isinf(yexp)) (~np.isinf(xth)) (~np.isinf(yth)) ValueError: operands could not be broadcast together with shapes (317,1) (325,1)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jorge-ramirez-upm/RepTate/issues/143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAYQHKTHDEIS5JIWE5K5STRTDAQLANCNFSM4NIYPRXQ .

--

[image: Industriales] ESCUELA SUPERIOR DE INGENIEROS INDUSTRIALES UNIVERSIDAD POLITÉCNICA DE MADRID

jorge-ramirez-upm commented 4 years ago

Hi, I removed the filters in all the views. It seems to work fine and reads the projects correctly. Can you try it? Jorge

On Sun, May 24, 2020 at 8:58 AM Victor Boudara notifications@github.com wrote:

  • Open Creep app
  • Load example datafile "CM3_Creep.creep"
  • Open theory "retardation mode" and get this error:

Error Traceback: File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1041, in handle_actionNew_Theory self.new_theory(th_name) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/gui/QDataSet.py", line 1051, in new_theory newth = self.do_new(th_name, calculate) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/DataSet.py", line 1264, in do_new th.do_calculate("") File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 378, in do_calculate self.do_error(line) File "/Users/victorbdr/Desktop/original_reptate2/RepTate/core/Theory.py", line 480, in do_error ~np.isinf(yexp)) (~np.isinf(xth)) (~np.isinf(yth)) ValueError: operands could not be broadcast together with shapes (317,1) (325,1)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jorge-ramirez-upm/RepTate/issues/143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAYQHKTHDEIS5JIWE5K5STRTDAQLANCNFSM4NIYPRXQ .

--

[image: Industriales] ESCUELA SUPERIOR DE INGENIEROS INDUSTRIALES UNIVERSIDAD POLITÉCNICA DE MADRID

vbdr commented 4 years ago

Fixed