<jupyter_start><jupyter_text>Set up a database with synthetic data<jupyter_code>db_name = 'temp_po.db'
db_folder = os.getcwd()
if not os.path.isfile(os.path.join(db_name, db_folder)):
    nt.new_database('temp_po.db', db_folder)
    e = qc.new_experiment("pinchoff_demo", sample_name="mock_pinchoff")
    populate_db_pinchoffs()

nt.set_database(db_name, db_folder)<jupyter_output>Upgrading database; v0 -> v1: : 0it [00:00, ?it/s]
Upgrading database; v1 -> v2: 100%|██████████| 1/1 [00:00<00:00, 113.68it/s]
Upgrading database; v2 -> v3: : 0it [00:00, ?it/s]
Upgrading database; v3 -> v4: : 0it [00:00, ?it/s]
Upgrading database; v4 -> v5: 100%|██████████| 1/1 [00:00<00:00, 96.87it/s]
Upgrading database; v5 -> v6: : 0it [00:00, ?it/s]
Upgrading database; v6 -> v7: 100%|██████████| 1/1 [00:00<00:00, 40.95it/s]
Upgrading database; v7 -> v8: 100%|██████████| 1/1 [00:00<00:00, 84.95it/s]
Upgrading database; v8 -> v9: 100%|██████████| 1/1 [00:00<00:00, 72.30it/s]
Starting experimental run with id: 1. 
Starting experimental run with id: 2. 
Starting experimental run with id: 3. 
Starting experimental run with id: 4. 
Starting experimental run with id: 5. 
Starting experimental run with id: 6. 
Starting experimental run with id: 7. 
Starting experimental run with id: 8. 
Starting experimental run with id: 9. 
Starting experimental run with id: 10.<jupyter_text>Initialize a PinchoffFitIt takes a QCoDeS run id (int), the name of the database where the data is stored and optionally the folder where the the database is stored.<jupyter_code>pf = PinchoffFit(1, db_name, db_folder=db_folder)<jupyter_output><empty_output><jupyter_text>Fitting procedureSpecifically, `find_fit` uses the following methods to extract the desired features: - `compute_initial_guess`: Computes bounds and an initial guess for amplitude, slope and offset of the hyperbolic tangent the pinchoff curve is fitted to.- `fit_fct` and `scipy.optimize.least_squares`: Optimize for *a*, *b*, *c* in  *fit_fct = a (1 + np.tanh(b  v + c))*.- `compute_transition_interval`: Determine low and hig voltages: the voltages between which a gate pinches off. Per default, the method takes the first derivate of either the normalized signal or fit and checks for which voltages it is higher than `gradient_percentile`. These voltages define the transition interval. Using this gradient strength comparison allows capture the entire interval. Compared to using for example the second derivate, the voltage interval will also include voltages where the signal reaches zero or saturation. It also provides a knob to increase or decrease the interval by changing `gradient_percentile` if required.- `compute_transition_voltage`: The transition is defined to occur at the maximum of the first derivative of either the normalized signal or the fit.- `save_features`: Method defined in the class DataFit which PinchoffFit inherits from and which saves all features into a single dict.<jupyter_code>pf.find_fit()<jupyter_output><empty_output><jupyter_text>FeaturesFeatures are extracted with the `find_fit` method and saved in the `features` attribute. Each trace (e.g. different readout sources) are fitted seperately. The readout methods used in the synthetic data example are `dc_current` and `dc_sensor`.<jupyter_code>pf.features<jupyter_output><empty_output><jupyter_text>VisualizationPinchoffFit has two methods to visualize the data and fitting features: - `plot_fit`: Shows the normalized trace together with its smoothed version, gradient and fit. It also indicated high, low and transition voltage found during fitting. - `plot_features`: Illustrates some of the features extracted during fitting and used for classification. Note that while high, low and transition voltage is required for further tuning, whereas high, low and transition current/signal is decisive for the measurement's quality. It does not matter where in voltage space a gate pinches off, but whether a gate is able to pinch off entirely for example.<jupyter_code>pf.plot_fit()
pf.plot_features()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0974169741697417, 'fraction_numerical': 0.033702337023370235, 'mean_word_length': 5.5056, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '124792', 'license': 'MIT', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1223, 'n_words': 494, 'path': 'docs/examples/PinchoffFit_example.ipynb', 'repo_name': 'theatlasroom/nanotune', 'size': '4065'}