Exemple #1
0
    def plot_histograms(self,
                        column='r',
                        primary_dim=None,
                        filename=None,
                        **kwargs):
        """Plot a histograms for all frequencies of one data column

        Parameters
        ----------
        column : str, optional
            data column to plot. defaults to "r" for resistance
        primary_dim : None|str
            ???
        filename : None|str
            Prefix for filename. Do not add a file ending here, as additional
            string will be appended here.
        **kwargs : dict
            ???

        TODO: Check saving to file for more than one secondary dimension
        Parameters
        ----------
        """
        dict_dimension, figs = HS.plot_histograms_extra_dims(
            self.data, column, primary_dim, **kwargs)
        if filename is not None:
            for key, item in figs.items():
                item.savefig(filename +
                             '_{}.jpg'.format(key).replace('_', '-'),
                             dpi=300)
        return dict_dimension, figs
Exemple #2
0
# ## Histogram plotting

# In[13]:

obj.data.dtypes

# In[14]:

import reda.plotters.histograms as RH

fig = RH.plot_histograms_extra_dims(
    obj,
    keys=[
        'rho_a',
    ],
    extra_dims=[
        'timestep',
    ],
    Nx=5,
    #subquery='timestep in {0}'.format(list(range(0, 100, 10))),
    subquery='timestep in [0, 3, 6]')
# print(fig.get_figwidth(), fig.get_figheight())
# fig.savefig('histogram.png', dpi=300)

# ## Plotting Pseudosections

# In[15]:

import reda.plotters.pseudoplots as PS

fig = PS.plot_ps_extra(obj, 'rho_a', subquery='timestep in [0, 3, 6]')
import glob

filenames = sorted(glob.glob('data/pygimli_*.ohm'))
for nr, filename in enumerate(filenames):
    obj.import_bert(filename, timestep=nr)

obj.compute_K_analytical(spacing=1)

# import reda.utils.norrec as NR
# NR.assign_norrec_to_df(obj.data)

import reda.plotters.histograms as RH
results = RH.plot_histograms_extra_dims(
    obj,
    keys=['rho_a'],
    extra_dims=[
        'timestep',
    ],
    Nx=5,
)
results.tight_layout()
results.savefig('histogram.png', dpi=300)

exit()
import IPython
IPython.embed()
exit()
# import IPython
# IPython.embed()
for key, item in results.items():
    item['all'].savefig('hist_{0}.png'.format(key), dpi=300)