brendanjmeade / celeri

Next generation earthquake cycle kinematics
BSD 3-Clause "New" or "Revised" License
24 stars 6 forks source link

celeri_direct_dense.ipynb is broken near estimation #81

Closed brendanjmeade closed 2 years ago

brendanjmeade commented 2 years ago

smoothing_keep_index = celeri.get_keep_index_12(operators.meshes[i].smoothing_matrix.shape[0]) Is smooth_matrix stored somewhere else now?

The error thrown is:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/pq/qqjshcd51vg5t9w5ws8wkmw00000gn/T/ipykernel_87673/2809936970.py in <module>
     85 
     86     # Insert TDE smoothing matrix
---> 87     smoothing_keep_index = celeri.get_keep_index_12(operators.meshes[i].smoothing_matrix.shape[0])
     88     estimation.operator[index.meshes[i].start_tde_smoothing_row:index.meshes[i].end_tde_smoothing_row, index.meshes[i].start_tde_col:index.meshes[i].end_tde_col] = operators.meshes[i].smoothing_matrix.toarray()[smoothing_keep_index, :][:, smoothing_keep_index]
     89 

~/Desktop/celeri/celeri/celeri.py in get_keep_index_12(length_of_array)
   2326         idx (np.array): Array of indices to return
   2327     """
-> 2328     idx = np.delete(np.arange(0, length_of_array), np.arange(2, length_of_array, 3))
   2329     return idx
   2330 

ValueError: invalid __array_struct__
brendanjmeade commented 2 years ago

This is because we are loading partials from a previous calculation and that are stored in an .hdf file. https://github.com/brendanjmeade/celeri/commit/be66de4337b76d5e8183cf903315b8639ed327dc recomputes everything from scratch and recovers the correct/reasonable answer.

@brendanjmeade Needs to rewrite the hdf save and read in.