<jupyter_start><jupyter_text>Working with SeismicDatasetSeismic dataset contains functions that calculate some parameters for the dataset.* [Find parameters for spherical divergence correction](Find-parameters-for-spherical-divergence-correction)<jupyter_code>import sys
import numpy as np
import matplotlib.pyplot as plt

sys.path.append('..')

from seismicpro.batchflow import Pipeline, V, D
from seismicpro.src import (SeismicDataset, FieldIndex, calculate_sdc_quality)<jupyter_output><empty_output><jupyter_text>First of all we have to create an index.<jupyter_code>path_raw = '/data/SD/dataset_1/2_TAR_raw.sgy'

field_index = FieldIndex(name='raw', extra_headers=['offset'], path=path_raw)<jupyter_output><empty_output><jupyter_text>Based on indexd and dataset one can create a dataset instance.<jupyter_code>dataset = SeismicDataset(field_index)<jupyter_output><empty_output><jupyter_text>Find parameters for spherical divergence correctionSpherical divergence correction action from ```SeismicBatch``` takes parameters based on which correction will be made. These parameters could be found for all dataset by ```find_sdc_params``` function. It uses speed, time and loss function to find optimal parameters for spherical divergence correction. In this example, speed was calculated by a specialist. By default, time takes from ```meta``` comonent.<jupyter_code>speed = np.array([1524]*700 + [1924.5]*300 + [2184.0]*400 +  [2339.6]*400 + 
                 [2676]*150 + [2889.5]*2250 + [3566]*2800 + [4785.3]*1000)<jupyter_output><empty_output><jupyter_text>Following line run optimization process. This process works with scipy optimization, so you can specify any parameters from ```scipy.optimize.minimize```. The optimization process takes a lot of time, this why it's calculated once for all dataset.<jupyter_code>parameters = dataset.find_sdc_params(component='raw', speed=speed,
                                     loss=calculate_sdc_quality)<jupyter_output><empty_output><jupyter_text>Founded parameters will be saved to the variable named ```parameters```.<jupyter_code>print('Optimal parameters for v_pow is {:.3}, for t_pow is {:.3}.'.format(*parameters))<jupyter_output>Optimal parameters for v_pow is 2.06, for t_pow is 0.998.
{'fraction_non_alphanumeric': 0.09933184855233854, 'fraction_numerical': 0.0334075723830735, 'mean_word_length': 6.1528662420382165, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '525692', 'license': 'Apache-2.0', 'n_tokens_mistral': 722, 'n_tokens_neox': 654, 'n_words': 198, 'path': 'tutorials/3.Dataset.ipynb', 'repo_name': 'pplotn/SeismicPro', 'size': '2245'}