<commit_before>"""
Slicer demo
===========

The example demonstrates the `plot_3d_slicer`

- contributed by `@prisae <https://github.com/prisae>`_

Using the inversion result from the example notebook
`plot_laguna_del_maule_inversion.ipynb <http://docs.simpeg.xyz/content/examples/04-grav/plot_laguna_del_maule_inversion.html#sphx-glr-content-examples-04-grav-plot-laguna-del-maule-inversion-py>`_

In the notebook, you have to use :code:`%matplotlib notebook`.
"""

# %matplotlib notebook
import shelve
import discretize
import numpy as np
import tarfile
import matplotlib.pyplot as plt
from matplotlib.colors import SymLogNorm
import sys

if sys.version_info[0] < 3:
    print("This example only runs on Python 3")
    sys.exit(0)

###############################################################################
# Download and load data
# ----------------------
#
# In the following we load the :code:`mesh` and :code:`Lpout` that you would
# get from running the laguna-del-maule inversion notebook.

f = discretize.utils.download(
    "https://storage.googleapis.com/simpeg/laguna_del_maule_slicer.tar.gz"
)
tar = tarfile.open(f, "r")
tar.extractall()
tar.close()

with shelve.open('./laguna_del_maule_slicer/laguna_del_maule-result') as db:
    mesh = db['mesh']
    Lpout = db['Lpout']

###############################################################################
# Case 1: Using the intrinsinc functionality
# ------------------------------------------
#
# 1.1 Default options
# ^^^^^^^^^^^^^^^^^^^

fig = plt.figure(figsize=(12, 12))
mesh.plot_3d_slicer(Lpout)

###############################################################################
# 1.2 Create a function to improve plots, labeling after creation
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Depending on your data the default option might look a bit odd. The look
# of the figure can be improved by getting its handle and adjust it.

def beautify(title, fig=None):<commit_msg>Remove according to review comments<commit_after>"""
Slicer demo
===========

The example demonstrates the `plot_3d_slicer`

- contributed by `@prisae <https://github.com/prisae>`_

Using the inversion result from the example notebook
`plot_laguna_del_maule_inversion.ipynb <http://docs.simpeg.xyz/content/examples/04-grav/plot_laguna_del_maule_inversion.html#sphx-glr-content-examples-04-grav-plot-laguna-del-maule-inversion-py>`_

In the notebook, you have to use :code:`%matplotlib notebook`.
"""

# %matplotlib notebook
import shelve
import discretize
import numpy as np
import tarfile
import matplotlib.pyplot as plt
from matplotlib.colors import SymLogNorm
import sys

if sys.version_info[0] < 3:
    print("This example only runs on Python 3")
    sys.exit(0)

###############################################################################
# Download and load data
# ----------------------
#
# In the following we load the :code:`mesh` and :code:`Lpout` that you would
# get from running the laguna-del-maule inversion notebook.

f = discretize.utils.download(
    "https://storage.googleapis.com/simpeg/laguna_del_maule_slicer.tar.gz"
)
tar = tarfile.open(f, "r")
tar.extractall()
tar.close()

with shelve.open('./laguna_del_maule_slicer/laguna_del_maule-result') as db:
    mesh = db['mesh']
    Lpout = db['Lpout']

###############################################################################
# Case 1: Using the intrinsinc functionality
# ------------------------------------------
#
# 1.1 Default options
# ^^^^^^^^^^^^^^^^^^^

mesh.plot_3d_slicer(Lpout)

###############################################################################
# 1.2 Create a function to improve plots, labeling after creation
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Depending on your data the default option might look a bit odd. The look
# of the figure can be improved by getting its handle and adjust it.

def beautify(title, fig=None):
{'fraction_non_alphanumeric': 0.2846251588310038, 'fraction_numerical': 0.008640406607369758, 'mean_word_length': 4.72093023255814, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4412463', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1161, 'n_words': 312}