<jupyter_start><jupyter_text>Sandstone Model First we make a GeMpy instance with most of the parameters default (except range that is given by the project). Then we also fix the extension and the resolution of the domain we want to interpolate. Finally we compile the function, only needed once every time we open the project (the guys of theano they are working on letting loading compiled files, even though in our case it is not a big deal).*General note. So far the reescaling factor is calculated for all series at the same time. GeoModeller does it individually for every potential field. I have to look better what this parameter exactly means*<jupyter_code># Setting extend, grid and compile
# Setting the extent
sandstone = GeMpy_core.GeMpy()

# Create Data class with raw data
sandstone.import_data( 696000,747000,6863000,6950000,-20000, 2000,
                                     path_f = os.pardir+"/input_data/a_Foliations.csv",
                                     path_i = os.pardir+"/input_data/a_Points.csv")

sandstone.Data.set_series({"EarlyGranite_Series":sandstone.Data.formations[-1], 
                      "BIF_Series":(sandstone.Data.formations[0], sandstone.Data.formations[1]),
                      "SimpleMafic_Series":sandstone.Data.formations[2]}, 
                       order = ["EarlyGranite_Series",
                              "BIF_Series",
                              "SimpleMafic_Series"])<jupyter_output><empty_output><jupyter_text>All input data is stored in pandas dataframes under, ```self.Data.Interances``` and ```self.Data.Foliations```:<jupyter_code>sandstone.Data.Foliations;
# Create a class Grid so far just regular grid
sandstone.create_grid()
sandstone.Grid.grid<jupyter_output><empty_output><jupyter_text>Plotting raw data<jupyter_code>sandstone.Plot.plot_data(serie = sandstone.Data.series.columns.values[1])<jupyter_output><empty_output><jupyter_text>Class Interpolator This class will take the data from the class Data and calculate potential fields and block<jupyter_code>sandstone.set_interpolator()<jupyter_output><empty_output><jupyter_text>Early granite<jupyter_code>sandstone.Plot.plot_potential_field(10, n_pf=0)<jupyter_output>/home/miguel/anaconda3/lib/python3.5/site-packages/matplotlib/font_manager.py:1288: UserWarning: findfont: Font family ['Times New Roman'] not found. Falling back to Bitstream Vera Sans
  (prop.get_family(), self.defaultFamily[fontext]))<jupyter_text>BIF Series<jupyter_code>sandstone.Plot.plot_potential_field(10, n_pf=1, cmap = "magma",  plot_data = False)<jupyter_output><empty_output><jupyter_text>SImple mafic<jupyter_code>sandstone.Plot.plot_potential_field(10, n_pf=2)<jupyter_output><empty_output><jupyter_text>Optimizing the export of lithologiesHere I am going to try to return from the theano interpolate function the internal type of the result (in this case DK I guess) so I can make another function in python I guess to decide which potential field I calculate at every grid_pos<jupyter_code># Reset the block
sandstone.Interpolator.block.set_value(np.zeros_like(sandstone.Grid.grid[:,0]))

# Compute the block
sandstone.Interpolator.compute_block_model([0,1,2], verbose = 1)
sandstone.Plot.plot_block_section()<jupyter_output><empty_output><jupyter_text>Export vtk<jupyter_code>"""Export model to VTK

Export the geology blocks to VTK for visualisation of the entire 3-D model in an
external VTK viewer, e.g. Paraview.

..Note:: Requires pyevtk, available for free on: https://github.com/firedrakeproject/firedrake/tree/master/python/evtk

**Optional keywords**:
    - *vtk_filename* = string : filename of VTK file (default: output_name)
    - *data* = np.array : data array to export to VKT (default: entire block model)
"""
vtk_filename = "noddyFunct2"

extent_x = 10
extent_y = 10
extent_z = 10

delx = 0.2
dely = 0.2
delz = 0.2
from pyevtk.hl import gridToVTK
# Coordinates
x = np.arange(0, extent_x + 0.1*delx, delx, dtype='float64')
y = np.arange(0, extent_y + 0.1*dely, dely, dtype='float64')
z = np.arange(0, extent_z + 0.1*delz, delz, dtype='float64')

# self.block = np.swapaxes(self.block, 0, 2)
gridToVTK(vtk_filename, x, y, z, cellData = {"geology" : sol})<jupyter_output><empty_output><jupyter_text>Performance Analysis  CPU<jupyter_code>%%timeit
sol =  interpolator.geoMigueller(dips,dips_angles,azimuths,polarity, rest, ref)[0]
sandstone.block_export.profile.summary()<jupyter_output>Function profiling
==================
  Message: /home/bl3/PycharmProjects/GeMpy/GeMpy/GeoMig.py:778
  Time in 12 calls to Function.__call__: 1.747251e+01s
  Time in Function.fn.__call__: 1.746418e+01s (99.952%)
  Time in thunks: 1.695012e+01s (97.010%)
  Total compile time: 8.084836e+00s
    Number of Apply nodes: 358
    Theano Optimizer time: 7.368957e+00s
       Theano validate time: 3.972366e-01s
    Theano Linker time (includes C, CUDA code generation/compiling): 4.228358e-01s
       Import time 0.000000e+00s

Time in all call to theano.grad() 0.000000e+00s
Time since theano import 4116.375s
Class
---
<% time> <sum %> <apply time> <time per call> <type> <#call> <#apply> <Class name>
  51.6%    51.6%       8.746s       6.57e-03s     C     1332     111   theano.tensor.elemwise.Elemwise
  21.5%    73.1%       3.647s       2.76e-02s     C      132      11   theano.tensor.basic.Alloc
   9.1%    82.2%       1.545s       4.29e-02s     Py      36       3   theano.tensor.basic.Nonzero
   [...]<jupyter_text>GPU<jupyter_code>%%timeit
# Reset the block
sandstone.block.set_value(np.zeros_like(sandstone.grid[:,0]))

# Compute the block
sandstone.compute_block_model([0,1,2], verbose = 0)
sandstone.block_export.profile.summary()<jupyter_output>Function profiling
==================
  Message: /home/miguel/PycharmProjects/GeMpy/GeMpy/GeoMig.py:791
  Time in 15 calls to Function.__call__: 7.831817e+00s
  Time in Function.fn.__call__: 7.828252e+00s (99.954%)
  Time in thunks: 7.533441e+00s (96.190%)
  Total compile time: 1.917513e+01s
    Number of Apply nodes: 468
    Theano Optimizer time: 4.435555e+00s
       Theano validate time: 4.534802e-01s
    Theano Linker time (includes C, CUDA code generation/compiling): 1.452507e+01s
       Import time 3.308706e-01s

Time in all call to theano.grad() 0.000000e+00s
Time since theano import 1392.894s
Class
---
<% time> <sum %> <apply time> <time per call> <type> <#call> <#apply> <Class name>
  69.2%    69.2%       5.213s       3.48e-01s     C       15       1   theano.sandbox.cuda.basic_ops.GpuAdvancedIncSubtensor1
  13.1%    82.3%       0.988s       7.49e-04s     C     1320      88   theano.tensor.elemwise.Elemwise
   4.3%    86.6%       0.322s       2.15e-03s     C      150      10  [...]
{'fraction_non_alphanumeric': 0.11064467766116942, 'fraction_numerical': 0.06431784107946027, 'mean_word_length': 3.8979441997063144, 'pattern_counts': {'":': 3, '<': 58, '<?xml version=': 0, '>': 58, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '394709', 'license': 'MIT', 'n_tokens_mistral': 2623, 'n_tokens_neox': 2306, 'n_words': 583, 'path': 'Prototype Notebook/.ipynb_checkpoints/Example 1 Sandstone Project-checkpoint.ipynb', 'repo_name': 'nre-aachen/gempy', 'size': '6670'}