sinanozaydin / pide

A python library for petrophysical calculations.
https://pide.readthedocs.io/
GNU General Public License v3.0
5 stars 2 forks source link

JOSS Review: Example Notebook `10_2D_Underworld_conversion.ipynb` #2

Open kujaku11 opened 3 months ago

kujaku11 commented 3 months ago

Running Jupyter notebook from examples/10_2D_Underworld_Conversion.ipynb produces the following error in the 3rd cell from the bottom [using pip install --> v0.3 and notebooks from main branch]:

The deformation related conductivity for the material Sediment_0 is calculated. The deformation related conductivity for the material Sediment_1 is calculated. The deformation related conductivity for the material Sediment_1 is calculated. The deformation related conductivity for the material Sediment_1 is calculated. The deformation related conductivity for the material Sediment_1 is calculated. The deformation related conductivity for the material Sediment_1 is calculated. The deformation related conductivity for the material Sediment_1 is calculated.

RemoteTraceback Traceback (most recent call last) RemoteTraceback: """ Traceback (most recent call last): File "\Anaconda3\envs\pide\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "\Anaconda3\envs\pide\lib\multiprocessing\pool.py", line 48, in mapstar return list(map(args)) File "k\Anaconda3\envs\pide\lib\site-packages\pide\model.py", line 287, in run_deform2cond c, str_dcy, cnd_dcy, msft = plastic_strain_2_conductivity(strain = p_strain[index_number[0],index_number[1]],low_cond = background_cond[index_number[0],index_number[1]], File "\Anaconda3\envs\pide\lib\site-packages\pide\geodyn\deform_cond.py", line 184, in plastic_strain_2_conductivity cond_calced,strain_decay_factor,conductivity_decay_factor,misfit = fit(method = scipy_methods[0], init_start = True, run_idx = 0, File "\Anaconda3\envs\pide\lib\site-packages\pide\geodyn\deform_cond.py", line 127, in fit params, params_cov = curve_fit(func, strains, conds, method = method, sigma = cond_err) File "\Anaconda3\envs\pide\lib\site-packages\scipy\optimize_minpack_py.py", line 925, in curve_fit ydata = np.asarray_chkfinite(ydata, float) File "\Anaconda3\envs\pide\lib\site-packages\numpy\lib\function_base.py", line 630, in asarray_chkfinite raise ValueError( ValueError: array must not contain infs or NaNs

sinanozaydin commented 1 month ago

The issues should be resolved in the latest version at the github repo (post-joss branch).

kujaku11 commented 3 days ago

@sinanozaydin After pulling from post_joss branch I have this error in running notebook 10. At cell:

deform_cond, strain_decay, cond_decay, misfit = mt_model_object.calculate_deformation_related_conductivity(method = 'plastic_strain',
                                                        cond_min = backgr_cond,
                                                        cond_max = max_cond,
                                                        function_method = 'exponential',                                       
                                                        low_deformation_threshold = 1e-2, high_deformation_threshold = 1e2, num_cpu = 5)

The deformation related conductivity for the material  Sediment_0  is calculated.
The deformation related conductivity for the material  Sediment_1  is calculated.
The deformation related conductivity for the material  Sediment_1  is calculated.
The deformation related conductivity for the material  Sediment_1  is calculated.
The deformation related conductivity for the material  Sediment_1  is calculated.
The deformation related conductivity for the material  Sediment_1  is calculated.
The deformation related conductivity for the material  Sediment_1  is calculated.
---------------------------------------------------------------------------
RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "[C:\Users\jpeacock\Anaconda3\envs\em\lib\multiprocessing\pool.py", line 125](file:///C:/Users/jpeacock/Anaconda3/envs/em/lib/multiprocessing/pool.py#line=124), in worker
    result = (True, func(*args, **kwds))
  File "[C:\Users\jpeacock\Anaconda3\envs\em\lib\multiprocessing\pool.py", line 48](file:///C:/Users/jpeacock/Anaconda3/envs/em/lib/multiprocessing/pool.py#line=47), in mapstar
    return list(map(*args))
  File "[C:\Users\jpeacock\Anaconda3\envs\em\lib\site-packages\pide\model.py", line 165](file:///C:/Users/jpeacock/Anaconda3/envs/em/lib/site-packages/pide/model.py#line=164), in run_model
    pide_object.set_mineral_conductivity_choice(ol = material.el_cond_selections['ol'],
  File "[C:\Users\jpeacock\Anaconda3\envs\em\lib\site-packages\pide\pide.py", line 1473](file:///C:/Users/jpeacock/Anaconda3/envs/em/lib/site-packages/pide/pide.py#line=1472), in set_mineral_conductivity_choice
    self._mineral_conductivity_choice_check()
  File "[C:\Users\jpeacock\Anaconda3\envs\em\lib\site-packages\pide\pide.py", line 1486](file:///C:/Users/jpeacock/Anaconda3/envs/em/lib/site-packages/pide/pide.py#line=1485), in _mineral_conductivity_choice_check
    if (pide.minerals_cond_selections[i] < 0) or (pide.minerals_cond_selections[i] > len(self.name[mineral_idx[i]])):
AttributeError: 'pide' object has no attribute 'name'
"""

The above exception was the direct cause of the following exception:

AttributeError                            Traceback (most recent call last)
Cell In[14], line 4
      1 #creating model_object
      2 mt_model_object = Model(material_list = material_object_list, material_array = material_array, T = temp_array, P = pressure_array, model_type = 'underworld_2d', melt = melt_array,
      3 p_strain = pstrain_array, material_node_skip_rate_list = material_skip_list)
----> 4 backgr_cond = mt_model_object.calculate_model(type = 'conductivity', num_cpu = 6)

File [~\Anaconda3\envs\em\lib\site-packages\pide\model.py:546](http://localhost:8888/lab/tree/pide/examples/notebooks/~/Anaconda3/envs/em/lib/site-packages/pide/model.py#line=545), in Model.calculate_model(self, type, num_cpu)
    541 with multiprocessing.Pool(processes=num_cpu) as pool:
    543     process_item_partial = partial(run_model, material =  material_list_holder[l][i], pide_object = mat_pide_obj, t_array = self.T,
    544     p_array = self.P, melt_array = self.melt_frac, type = type)
--> 546     c = pool.map(process_item_partial, sliced_material_idx)
    548 #assigning to the global cond list
    549 for idx in range(0,len(sliced_material_idx)):

File [~\Anaconda3\envs\em\lib\multiprocessing\pool.py:367](http://localhost:8888/lab/tree/pide/examples/notebooks/~/Anaconda3/envs/em/lib/multiprocessing/pool.py#line=366), in Pool.map(self, func, iterable, chunksize)
    362 def map(self, func, iterable, chunksize=None):
    363     '''
    364     Apply `func` to each element in `iterable`, collecting the results
    365     in a list that is returned.
    366     '''
--> 367     return self._map_async(func, iterable, mapstar, chunksize).get()

File [~\Anaconda3\envs\em\lib\multiprocessing\pool.py:774](http://localhost:8888/lab/tree/pide/examples/notebooks/~/Anaconda3/envs/em/lib/multiprocessing/pool.py#line=773), in ApplyResult.get(self, timeout)
    772     return self._value
    773 else:
--> 774     raise self._value

AttributeError: 'pide' object has no attribute 'name'
sinanozaydin commented 3 days ago

Hello @kujaku11 ,

Thanks! I should have indicated but it's probably best if you pulled from the main branch! It should likely work over there.