Sampling¶
- 
delphin_6_automation.sampling.sampling.calculate_error(sample_strategy: delphin_6_automation.database_interactions.db_templates.sample_entry.Strategy) → dict[source]¶ Calculates the standard error on the results from the given delphin simulations
- 
delphin_6_automation.sampling.sampling.calculate_sample_output(sample_strategy: dict, sampling_id: str) → None[source]¶ Compute the mean and standard deviation of the simulation results for a given sample
- 
delphin_6_automation.sampling.sampling.check_convergence(strategy_document: delphin_6_automation.database_interactions.db_templates.sample_entry.Strategy) → bool[source]¶ Check if the standard error is lower than the threshold value in the sampling strategy If it is return True otherwise return False
- 
delphin_6_automation.sampling.sampling.compute_sampling_distributions(sampling_strategy: dict, samples_raw: numpy.ndarray, used_samples_per_set: int) → dict[source]¶ Compute the sampling values for the sampling strategy
- 
delphin_6_automation.sampling.sampling.create_delphin_projects(sampling_strategy: dict, samples: dict, folder='C:\\Users\\ocni\\PycharmProjects\\delphin_6_automation\\delphin_6_automation\\sampling\\input_files/design') → List[str][source]¶ Generate the Delphin project associated with the given sample
- 
delphin_6_automation.sampling.sampling.create_samples(sampling_strategy: delphin_6_automation.database_interactions.db_templates.sample_entry.Strategy, used_samples_per_set: int) → dict[source]¶ Creates new samples fitting the sampling strategy. Raw samples are generated if they do not exist already. The function loops through the sampling sequences and generate samples each time.
Parameters: - sampling_strategy – Sampling Strategy
 - used_samples_per_set – How many samples should be generated per set
 
Returns: The generated samples
- 
delphin_6_automation.sampling.sampling.create_sampling_strategy(path: str) → dict[source]¶ Create a sampling strategy for WP6 Delphin Automation. The sampling strategy will be name ‘sampling_strategy.json’ and be located at the given folder.
Parameters: path (str) – Folder, where the strategy will be saved. Returns: Created sampling strategy Return type: dict 
- 
delphin_6_automation.sampling.sampling.get_raw_samples(sampling_strategy: delphin_6_automation.database_interactions.db_templates.sample_entry.Strategy, step: int) → numpy.ndarray[source]¶ Collects raw samples from database associated with sampling strategy. If the raw samples do not exists in the database new ones will be created by calling the Sobol function
- 
delphin_6_automation.sampling.sampling.initialize_sampling(strategy_doc: delphin_6_automation.database_interactions.db_templates.sample_entry.Strategy) → tuple[source]¶ Initialize a sampling
- 
delphin_6_automation.sampling.sampling.load_design_options(designs: List[str], folder: str) → List[dict][source]¶ Loads the Delphin files into memory associated with the design options
- 
delphin_6_automation.sampling.sampling.load_latest_sample(sampling_strategy_id: str) → Optional[delphin_6_automation.database_interactions.db_templates.sample_entry.Sample][source]¶ Look up the last existing sample entries in the database connected to the strategy If there is not previous samples in database return empty dict
Parameters: sampling_strategy_id – Sampling strategy id Returns: Return the samples as a dict 
- 
delphin_6_automation.sampling.sampling.load_strategy(path: str) → dict[source]¶ Load a sampling strategy from a JSON file.
Parameters: path – Folder, where the sampling strategy is located Returns: Sampling strategy 
- 
delphin_6_automation.sampling.sampling.relative_standard_error(series: list, sequence_length: int) → float[source]¶ Calculate the relative standard error
Source: Hou, T, et. al. Quasi-Monte Carlo based uncertainty analysis: sampling effciency and error estimation Reliability Engineering & System Safety 2018
- 
delphin_6_automation.sampling.sampling.sample_exists(sampling_strategy: delphin_6_automation.database_interactions.db_templates.sample_entry.Strategy) → Optional[delphin_6_automation.database_interactions.db_templates.sample_entry.Sample][source]¶ Check whether a sample exists with the same iteration as the current iteration in the sampling strategy