<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Using the UncertaintyAnalysis class
Methods for visualising the lithological variability produced by purturbation of the input datasets, which can be considered a proxy for lithological uncertainty, are implemented in the UncertaintyAnalysis class.
Initialisising a new UncertaintyAnalysis experiment is no different to initialising a MonteCarlo experiment (as UncertaintyAnalysis uses this class extensively) - we load a history file and associated csv file defining the PDF's to sample the input data from.
Step1:  The next step is to perform the Monte Carlo purturbation of this initial model, and use this to estimate uncertainty. This sampling is wrapped into the estimate_uncertainty function - all that is required from us is the number of trials to produce. Realistically, several thousand samples are typically necessary before sampling can be considered representative. However, in order to speed things up a bit we'll produce 10 model samples.
Step2:  Now, a quick description of what we have done... the estimate_uncertainty function generates the specified amount (10) of randomly varying models using the MonteCarlo class. It then loads the output and loops calculates the lithology present at each voxel in each model. This information is used to calculate probability maps for each lithology at each point in the model! This can be seen if we plot the probability of observing lithology 3
Step3:  These probability maps can then be used to calculate the information entropy of each cell. These can then be plotted as follows
<ASSISTANT_TASK:>
Python Code:
reload(pynoddy.history)
reload(pynoddy.output)
reload(pynoddy.experiment.uncertainty_analysis)
reload(pynoddy)
from pynoddy.experiment.uncertainty_analysis import UncertaintyAnalysis
# the model itself is now part of the repository, in the examples directory:
history_file = os.path.join(repo_path, "examples/fold_dyke_fault.his")
#this file defines the statistical distributions to sample from
params = os.path.join(repo_path, "examples/fold_dyke_fault.csv")
uc_experiment = UncertaintyAnalysis(history_file,params)
#plot the intial model
uc_experiment.change_cube_size(55)
uc_experiment.plot_section(direction='y',position='center')
Explanation: Using the UncertaintyAnalysis class
Methods for visualising the lithological variability produced by purturbation of the input datasets, which can be considered a proxy for lithological uncertainty, are implemented in the UncertaintyAnalysis class.
Initialisising a new UncertaintyAnalysis experiment is no different to initialising a MonteCarlo experiment (as UncertaintyAnalysis uses this class extensively) - we load a history file and associated csv file defining the PDF's to sample the input data from.
End of explanation
uc_experiment.estimate_uncertainty(10,verbose=False)
Explanation: The next step is to perform the Monte Carlo purturbation of this initial model, and use this to estimate uncertainty. This sampling is wrapped into the estimate_uncertainty function - all that is required from us is the number of trials to produce. Realistically, several thousand samples are typically necessary before sampling can be considered representative. However, in order to speed things up a bit we'll produce 10 model samples.
End of explanation
uc_experiment.plot_probability(4, direction='y',position='center')
Explanation: Now, a quick description of what we have done... the estimate_uncertainty function generates the specified amount (10) of randomly varying models using the MonteCarlo class. It then loads the output and loops calculates the lithology present at each voxel in each model. This information is used to calculate probability maps for each lithology at each point in the model! This can be seen if we plot the probability of observing lithology 3:
End of explanation
uc_experiment.plot_entropy(direction='y',position='center')
Explanation: These probability maps can then be used to calculate the information entropy of each cell. These can then be plotted as follows:
End of explanation
<END_TASK>