Welcome to MLFoMpy’s documentation!

1. Description

MLFoMpy is a post-processing tool for semiconductor TCAD data. The center object of this tool is the fds (MLFoMpy Dataset), in which through the parsers, all the necessary information is stored. There are also defined different utilities to process the data stored in the fds object, as to extract figures of merit, to plot or to save results in files.

The source code of MLFoMpy can be downloaded from https://gitlab.citius.usc.es/modev/mlfompy and is purely intended to run as a library for Linux systems. Note that the following instalation steps work on Debian-derived distributions: e.g. for Ubuntu 16.04 or later and CentOS (tested). Also, MLFoMpy has been proven to work in Python 3.6.

In the figure below the user can see the basic workflow behind the MLFoMpy library:

alternate text

Scheme of the MLFoMpy post-processing tool

2. Contact info and bug reports

If you have any cuestion or suggestion or you want to report a bug, please use this form:

3. Getting Started

Before using MLFoMpy you need to have installed pip3 on your system. For Ubuntu, open up a terminal and type:

sudo apt update
sudo apt install python3-pip

The use of virtual environments is highly encouraged. The main purpose of Python virtual environments is to create an isolated environment for Python projects so that no modular dependency issues with other projects can appear. In order to use them run the following commands in a terminal:

#Install virtual environments
sudo apt install python3-venv
#Create and name the environment "venv"
python3 -m venv .venv
#Activate the venv
source .venv/bin/activate

Note that as of this moment you’re inside a virtual environment (Notice (.venv) $ in the terminal) with a isolated version of python and therefore you will have to install all the packages you need for that particular project (including the ones you may have installed in the system as they may not be installed in the virtual environment).

Instalation of MLFoMpy via pip3

1. Instalation using Python Package Index (Pypi)

For basic usage of the tool (figure of merit extraction), install the tool using pip3:

pip3 install mlfompy

To add the machine learning functionality for figure of merit and I-V characteristic predictions, install the library using the command:

pip3 install mlfompy[ML]

2. Using the repository

For direct instalation from the repository, it is necessary to have git installed on your system. For Ubuntu, open up a terminal and type:

sudo apt update
sudo apt install git

Then install the library using the command:

pip3 install git+https://gitlab.citius.usc.es/modev/mlfompy.git

Another alternative is downloading the repository. You obtain a compressed file, once decompressed, the folder mlfompy-main will appear. Then, it is neccesary to run the following command in a terminal indicating the path where mlfompy-main is located (/PATH/MLFOMPY):

pip install -e /PATH/MLFOMPY

3. Test the installation

Check the library is installed by importing it from a python3 terminal:

import mlfompy

Unless an error comes up, MLFoMpy is now installed on your virtual environment.

Note: Most of the packages will be installed automatically during the MLFoMpy instalation. If you experience some issue, you can try to install the needed modules them yourself by typing in a terminal:

pip3 install setuptools pytest numpy scipy probscale matplotlib pyocclient yachalk torch pytorch-lightning torcheval torchmetrics scikit-learn
sudo apt-get install python3-tk torch pytorch-lightning torcheval torchmetrics scikit-learn

4. Usage examples

In the project folder examples there are several scripts and Jupyter notebooks (.ipynb files) that show the library functionality:

  • Basic usage of the software functionalities in Python script basic_usage.py

  • Figure of merit extraction for drift-diffusion, Monte Carlo, or combined simlations in the Jupyter notebook extract_dd_mc.py

  • Machine learning models and utilities to predict figures of merit and I-V characteristic in the Jupyter notebooks train_mlp_ler.ipynb, train_mlp_mgg_fom.ipynb and train_mlp_mgg_iv.ipynb

5. Modules

MLFoMpy is composed of the following modules:

MLFoMpyDataset module

Main object (fds) of the MLFoMpy software

class mlfompy.mlfompy_dataset.MLFoMpyDataset(**kwargs)[source]
get_n_sims()[source]
get_n_sims_dd()[source]
get_n_sims_mc()[source]
property n_sims
property n_sims_dd
property n_sims_mc

Parser module

Functions to import and parser data to MLFoMpyDataset

mlfompy.parser.import_from_local_repo(fds, path, var='', param='')[source]

Stores the repository compressed data (MC or DD) into a temp directoty and imports to MLFoMpy Dataset.

Parameters:
  • fds (MLFoMpyDataset) –

  • path (Path) – Parent path where the simulations are stored

  • var (str) – Variability type accepted values: [‘MGG’,’LER’,’GER’,’RD’]

  • param (str) –

    Variability parameter accepted values:
    • if var is ‘MGG’ then ‘GSx’ where x is the grain size

    • if var is ‘LER’ then ‘CLx_RMSy’ where x is the correlation length and y the root mean square

    • if var is ‘GER’ then ‘CLx_RMSy’ where x is the correlation length and y the root mean square

    • if var is ‘RD’ then TODO

mlfompy.parser.import_from_nextcloud_repo(fds, server_url, repo_path, user, passwd, var, param)[source]

Downloads a nextcloud repository into a temp directoty and calls import_from_local_repo().

Parameters:
  • fds (MLFoMpyDataset) –

  • purl (url) – Nextcloud repository path

  • user (str) – Username to access the repository

  • passwd (str) – Password to access the repository

  • var (str) – Variability type accepted values: [‘MGG’,’LER’,’GER’,’RD’]

  • param (str) –

    Variability parameter accepted values:
    • if var is ‘MGG’ then ‘GSx’ where x is the grain size

    • if var is ‘LER’ then ‘CLx_RMSy’ where x is the correlation length and y the root mean square

    • if var is ‘GER’ then ‘CLx_RMSy’ where x is the correlation length and y the root mean square

    • if var is ‘RD’ then TODO

mlfompy.parser.iv_curve(fds, iv)[source]

Imports the simulated data from a iv list and stores it into a MLFoMpy Dataset.

Parameters:
  • fds (MLFoMpyDataset) –

  • iv (list) – single curve (x, y) where x = v_gate and y = i_drain

mlfompy.parser.iv_from_JCJB(fds, path, original_path=None)[source]

Imports the simulated data from a given JCJB.dat file and stores it into a MLFoMpy Dataset.

Parameters:
  • fds (MLFoMpyDataset) –

  • path (Path) – Parent path where the simulations are stored

mlfompy.parser.iv_from_MC(fds, path, original_path=None)[source]

Imports the simulated data from a given fichero_particula file from MC simulation and stores it into a MLFoMpy Dataset.

Parameters:
  • fds (MLFoMpyDataset) –

  • path (Path) – Parent path where the simulations are stored

mlfompy.parser.iv_from_files(fds, path)[source]

Imports the simulated data from a given file and stores it into a MLFoMpy Dataset. It is assumed that the .txt .dat .out extensions, are files with data separated by tab and .csv by commas

Parameters:
  • fds (MLFoMpyDataset) –

  • path (Path) – Parent path where the simulations are stored

Extraction methods module

Functions to import and parser data to MLFoMpyDataset

mlfompy.extraction_methods.dd_on_current(fds, vg_ext)[source]

Extracts the on current at a fixed gate potential (vg_ext)

Parameters:
  • fds (MLFoMpyDataset) –

  • vg_ext (float) – Gate potential chosen to extract the on current

mlfompy.extraction_methods.mc_on_current(fds)[source]

Extracts the on current from a MC output

Parameters:

fds (MLFoMpyDataset) –

mlfompy.extraction_methods.off_current(fds, vg_ext)[source]

Extracts the off current at a fixed gate potential (vg_ext)

Parameters:
  • fds (MLFoMpyDataset) –

  • vg_ext (float) – Gate potential chosen to extract the off current

mlfompy.extraction_methods.subthreshold_slope(fds, vg_start=None, vg_end=None)[source]

Extracts the subthreshold slope in the linear region defined between vg_start and vg_end. By default vg_start is fixed to the first gate potential and vg_end to vth_sd/2

Parameters:
  • fds (MLFoMpyDataset) –

  • vg_start (float) – First gate potential chosen to extract the subthreshold slope

  • vg_end (float) – Last gate potential chosen to extract the subthreshold slope

mlfompy.extraction_methods.threshold_voltage(fds, method=None, cc_criteria=None)[source]

Extracts the threshold voltage using the desired method: https://doi.org/10.1016/j.microrel.2012.09.015

Parameters:
  • fds (MLFoMpyDataset) –

  • method (str) – Method accepted values: [‘SD’,’LE’,’CC’]

  • cc_criteria (float) – Consant current criteria chosen in [A]

mlfompy.extraction_methods.threshold_voltage_cc_method(fds, cc_criteria, interpolation_points=10000)[source]

Extracts the threshold voltage using the constant current (CC) method: https://doi.org/10.1016/j.microrel.2012.09.015

Parameters:
  • fds (MLFoMpyDataset) –

  • cc_criteria (float) – Consant current criteria chosen in [A]

  • interpolation_points (int, fixed to 1000) – Number of interpolation points required

mlfompy.extraction_methods.threshold_voltage_le_method(fds, interpolation_points=10000)[source]

Extracts the threshold voltage using the linear extraction method https://doi.org/10.1016/j.microrel.2012.09.015

Parameters:
  • fds (MLFoMpyDataset) –

  • interpolation_points (int, fixed to 1000) – Number of interpolation points required

mlfompy.extraction_methods.threshold_voltage_sd_method(fds, interpolation_points=1000)[source]

Extracts the threshold voltage using the second derivative (SD) method: https://doi.org/10.1016/j.microrel.2012.09.015

Parameters:
  • fds (MLFoMpyDataset) –

  • interpolation_points (int, fixed to 1000) – Number of interpolation points required

Machine learning models module

Models for the neural networks for FoM and I-V curves prediction.

class mlfompy.ml_models.CustomDataset(data_in, data_out)[source]

Dataset class

class mlfompy.ml_models.mlp_mgg_fom(config)[source]

Class for the multi-layer perceptron applied to predict the FoMs due to MGG

configure_optimizers()[source]

Optimization algorithm

forward(x)[source]

Prediction/inference actions

init_weights_normal(module)[source]

Initialization of the weights of neural network layers and nodes with a normal distribution with mean=0, with std as a hyperparameter

test_step(test_batch, batch_idx)[source]

Test loop with MSE as loss function, R2 and MAPE metrics to visualize

training_step(train_batch, batch_idx)[source]

Training loop with MSE as loss function, R2 metric to visualize

validation_step(val_batch, batch_idx)[source]

Validation loop with MSE as loss function, R2 metric to visualize

class mlfompy.ml_models.mlp_mgg_iv(config)[source]

Multi-layer perceptron applied to predict the I-V curves due to MGG. Structure of the NN is defined here

configure_optimizers()[source]

Optimization algorithm

forward(x)[source]

Prediction/inference actions

init_weights_he(module)[source]

The current standard approach for initialization of the weights of neural network layers and nodes that use the rectified linear (ReLU) activation function is called “he” initialization.

init_weights_normal(module)[source]

Initialization of the weights of neural network layers and nodes with a normal distribution with mean=0, with std as a hyperparameter

init_weights_xavier(module)[source]

The current standard approach for initialization of the weights of neural network layers and nodes that use the Sigmoid or TanH activation function is called “glorot” or “xavier” initialization

test_step(test_batch, batch_idx)[source]

Test loop with MSE as loss function, R2 and MAPE metrics to visualize

training_step(train_batch, batch_idx)[source]

Training loop with MSE as loss function, R2 metric to visualize

validation_step(val_batch, batch_idx)[source]

Validation loop with MSE as loss function, R2 metric to visualize

Machine learning traning and testing module

Functions to perform the training and testing of the machine learning models and the PCA and scaler objects.

mlfompy.ml_train_exp.generate_dataloaders(X_train, X_val, X_test, Y_train, Y_val, Y_test, config, num_workers=10)[source]

Generation of the DataLoaders to the train, validation and test processes. The DataLoaders combines a dataset and a sampler, and provides an iterable over the given dataset.

Parameters:
  • X_train (torch.tensor) – Input train subsets

  • X_val (torch.tensor) – Input validation subsets

  • X_test (torch.tensor) – Input test subsets

  • config (dictionary) – Contains the key:value pairs for the neural network hyperparameters

  • num_workers (int) – How many subprocesses to use for data loading. 0 means that the data will be loaded in the main process

Returns:

  • train_loader (Dataloader) – Iterable object to train

  • val_loader (Dataloader) – Iterable object to validate

  • test_loader (Dataloader) – Iterable obejct to test

mlfompy.ml_train_exp.input_output_fom_select(data, var_source='mgg', fom='vth_LE [V]')[source]

Creates the neural network input and output pytorch tensors, fom=’vth_LE [V]’ by default

Parameters:
  • data (dictionary) – Simulated data

  • fom (str) –

    Choose the figure of merit for the neural network training. Accepted labels:
    • For Vth: [‘vth_LE [V]’], [‘vth_SD [V]], [‘vth_CC [V]]

    • For ioff: [‘ioff_VG [A]’]

    • For SS: [‘ss_VGI [mV/dec]’]

    • For ion: [‘ion_dd_VG [A]’], [‘ion_mc_VG [A]’]

Returns:

  • X (torch.tensor) – Input tensor for the neural network

  • Y (torch.tensor) – Output tensor for the neural network

mlfompy.ml_train_exp.input_output_iv(data)[source]

Creates the neural network input (mgg_profiles) and output (logIoff) pytorch tensors

Parameters:

data (dict) – Simulated data

Returns:

  • X (dict) – Input dict for the neural network with ids

  • Y (dict) – Output dict with the log10Ioff for the neural network with ids

mlfompy.ml_train_exp.ler_finetune_model(X_train, Y_train, regressor, config={})[source]

Fine-tunning existing predictor model

Parameters:
  • X_train (list of values) – Input train subsets

  • Y_train (list of values) – Input test subsets

  • config (dictionary) – Contains the key:value pairs for the hyperparameters configuration. Options are: - iterations: max. number of iterations - activation: activation function for MLP. Default is tanh.

Returns:

regressor – Fitted sklearn regressor object

Return type:

Sklearn regressor object

mlfompy.ml_train_exp.ler_train_model(x, y, config={})[source]

Training process to calibrate predictor the foms for LER variabitlity This function is based on different regressors from sklearn library

The regressor to be fitted or trained are the following from sklearn and it can be selected using the config parameter with the regressor key and posible values are: MLP (default), LinearRegression, DecisionTree, RandomForest or SVM

These regressors have been already tested with LER varaibility data and the results can be checked in https://doi.org/10.1371/journal.pone.0288964

Parameters:
  • x (list of values) – Input subsets

  • y (list of values) – Output subsets

  • config (dictionary) – Contains the key:value pairs for the hyperparameters configuration. Options are: - regressor: MLP (default), LinearRegression, DecisionTree, RandomForest or SVM - seed: random seed - iterations: max. number of iterations - activation: activation function for MLP. Default is tanh.

Returns:

regressor – Fitted sklearn regressor object

Return type:

Sklearn regressor object

mlfompy.ml_train_exp.mgg_train_test_fom(X_train, X_val, X_test, Y_train, Y_val, Y_test, config=None, num_epochs=1500)[source]

Train and test process to calibrate the neural network and predict the foms

Parameters:
  • X_train (torch.tensor) – Input train subsets

  • X_val (torch.tensor) – Input validation subsets

  • X_test (torch.tensor) – Input test subsets

  • config (dictionary) – Contains the key:value pairs for the neural network hyperparameters

  • num_epochs (int) – Number of epochs, 1500 by default as it is implemented the early stopping method

Returns:

model – Calibrated neural network model

Return type:

pytorch lightning object

mlfompy.ml_train_exp.mgg_train_test_iv(X_train, X_val, X_test, Y_train, Y_val, Y_test, config=None, num_epochs=1500)[source]

Train and test process to calibrate the neural network and predict the I-V curves

Parameters:
  • X_train (torch.tensor) – Input train subsets

  • X_val (torch.tensor) – Input validation subsets

  • X_test (torch.tensor) – Input test subsets

  • config (dictionary) – Contains the key:value pairs for the neural network hyperparameters

  • num_epochs (int) – Number of epochs, 1500 by default as it is implemented the early stopping method

Returns:

- model – Calibrated neural network model

Return type:

pytorch lightning object

mlfompy.ml_train_exp.pca_features_reduction(X_train, X_val, X_test, criteria=0.95)[source]

Applies the PCA methodology to reduce the features. The PCA is fitted to the train dataset, by default to the 95% of the cummulative variance

Parameters:
  • X_train (torch.tensor) – Input train subsets

  • X_val (torch.tensor) – Input validation subsets

  • X_test (torch.tensor) – Input test subsets

  • criteria (float) – If the criteria is an integer, the criteria correspond to the number of features reduction after applying PCA If the criteria is a float between 0 and 1, correspond to apply the criteria of a percentage of the total cummulative variance

Returns:

  • X_train_pca (torch.tensor) – Input train subset afet applying the PCA reduction

  • X_val_pca (torch.tensor) – Input validation subset afet applying the PCA reduction

  • X_test_pca (torch.tensor) – Input test subset afet applying the PCA reduction

  • pca (pca_object) – pca object with the information of the features reduction

mlfompy.ml_train_exp.save_sk_model(model, type)[source]

Saves a model in sk_logs folder in working directory

Parameters:
  • model (objet) – Model object to be saved

  • type (str) – Model type to select the log destination folder. Values: regressor, finetuned, pca or scaler

mlfompy.ml_train_exp.scaler_to_data(x, scaler_selector='StandarScaler', scaler=None)[source]

Scales the input data using the selected scaler

Parameters:
  • x (list) – Input data

  • scaler_selector (str) –

    Select the scaler to be used. Accepted labels:
    • ”StandarScaler” (default) from sklearn.preprocessing library

    • ”MinMaxScaler” from sklearn.preprocessing library

    • ”MaxAbsScaler” from sklearn.preprocessing library

    • ”RobustScaler” from sklearn.preprocessing library

    • ”QuantileTransformer” from sklearn.preprocessing library

    • ”PowerTransformer” from sklearn.preprocessing library

  • scaler (sklearn.preprocessing object) – If scaler is not None, the scaler object is used to scale the data

Returns:

  • x_scaled (list) – Scaled input data

  • scaler (sklearn.preprocessing object) – Scaler object used to scale the data

mlfompy.ml_train_exp.split_data(X, Y, test_size=0.2)[source]

Split the data into the train, validation and test subsets

Parameters:
  • X (dict or torch.tensor) – Input data to split

  • Y (dict or torch.tensor) – Output data to split

  • test_size (float) – Ratio for the test/train and validation/train split, by default is set to 0.2

Returns:

  • X_train/Y_train (dict or torch.tensor) – Input/Output train subsets

  • X_val/Y_val (dict or torch.tensor) – Input/Output validation subsets

  • X_test/Y_test (dict or torch.tensor) – Input/Output test subsets

Plots module

Auxiliar functions used in other modules

mlfompy.plots.__fom_method_selector(fds, fom, method)[source]

Auxiliar function to select the figure of merit method

Parameters:
  • fds (MLFoMpyDataset) – Path to store the json file with the FoMs and statistics

  • fom (str) – Figure of merit to plot, accepted values: [‘vth’,’ioff’,’ss’,’ion_dd’, ‘ion_mc’]

  • method (str) – Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’] Extraction method used for ioff: [‘VG’] Extraction method used for ss: [‘VGI’] Extraction method used for ion_dd: [‘VG’] Extraction method used for ion_mc: [‘VG’]

mlfompy.plots.extraction_ioff_plot(fds, curve_number)[source]

Plot for Ioff extraction method

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to plot

mlfompy.plots.extraction_ion_plot(fds, curve_number)[source]

Plot for Ion extraction method

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to plot

mlfompy.plots.extraction_method_plot(fds, fom, method=None, curve_number=0)[source]

Interface function to extraction method plot selection

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to see the LE extraction method

mlfompy.plots.extraction_ss_plot(fds, curve_number)[source]

Plot for SS extraction method

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to plot

mlfompy.plots.extraction_vth_cc_plot(fds, curve_number)[source]

Plot for CC vth extraction method

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to plot

mlfompy.plots.extraction_vth_le_plot(fds, curve_number)[source]

Plot for LE vth extraction method

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to plot

mlfompy.plots.extraction_vth_sd_plot(fds, curve_number)[source]

Plot for SD vth extraction method

Parameters:
  • fds (MLFoMpy dataset) –

  • curve_number (float) – Number of simulation curve to plot

mlfompy.plots.fom_correlation(fds, fom1, fom2, method1=None, method2=None)[source]

Scatter plots with histograms to show correlation between FoMs. For Vth by default method=None is assigned to the LE.

Parameters:
  • fds (MLFoMpyDataset) – Path to store the json file with the FoMs and statistics

  • fom1 (str) – Y-Axis Figure of merit to plot, accepted values: [‘vth’,’ioff’,’ss’,’ion_dd’, ‘ion_mc’]

  • method1 (str) –

    • Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’]

    • Extraction method used for ioff: [‘VG’]

    • Extraction method used for ss: [‘VGI’]

    • Extraction method used for ion_dd: [‘VG’]

    • Extraction method used for ion_mc: [‘VG’]

  • fom2 (str) – X-Axis Figure of merit to plot, accepted values: [‘vth’,’ioff’,’ss’,’ion_dd’, ‘ion_mc’]

  • method2 (str) –

    • Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’]

    • Extraction method used for ioff: [‘VG’]

    • Extraction method used for ss: [‘VGI’]

    • Extraction method used for ion_dd: [‘VG’]

    • Extraction method used for ion_mc: [‘VG’]

mlfompy.plots.hist(fds, fom, method=None)[source]

Plots the histogram with the method defined. The mean and the standard deviation are also shown together with the gaussian density function. By default method=None is assigned to the LE.

Parameters:
  • fds (MLFoMpyDataset) – Path to store the json file with the FoMs and statistics

  • fom (str) – Figure of merit to plot, accepted values: [‘vth’,’ioff’,’ss’,’ion_dd’, ‘ion_mc’]

  • method (str) –

    • Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’]

    • Extraction method used for ioff: [‘VG’]

    • Extraction method used for ss: [‘VGI’]

    • Extraction method used for ion_dd: [‘VG’]

    • Extraction method used for ion_mc: [‘VG’]

mlfompy.plots.hist_kde(fds, fom, method=None)[source]

Plots the histogram with the method defined. The mean and the standard deviation are also shown together with the kernel density function. By default method=None is assigned to the LE.

Parameters:
  • fds (MLFoMpyDataset) – Path to store the json file with the FoMs and statistics

  • fom (str) – Figure of merit to plot, accepted values: [‘vth’,’ioff’,’ss’,’ion_dd’, ‘ion_mc’]

  • method (str) –

    • Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’]

    • Extraction method used for ioff: [‘VG’]

    • Extraction method used for ss: [‘VGI’]

    • Extraction method used for ion_dd: [‘VG’]

    • Extraction method used for ion_mc: [‘VG’]

mlfompy.plots.iv_curves_simulation_prediction(i_simulated, i_predicted, vg_start=0, vg_end=1.0, scale='lin', storepath=None)[source]

Plot for the comparison of the simulated versus predicted iv curves with machine learning

Parameters:
  • i_simulated (list or torch.tensor) – Simulated data

  • i_predicted (list or torch.tensor) – Predicted data

  • vg_start (float) – Vg of the first current

  • vg_end (float) – Vg of the last current

  • scale (str) – Scale of the Y-Axis, two options: linear ‘lin’, or logarithmic ‘log’

  • storepath (str) – Path to store the plot, by default is stored in the execution directory

mlfompy.plots.prediction_versus_simulation_plot(simulation, prediction, r2, xlabel=None, ylabel=None, rms=None, storepath=None)[source]

Plot for the comparison of the simulated versus predicted data with machine learning

Parameters:
  • simulation (list or torch.tensor) – Simulated data

  • prediction (list or torch.tensor) – Predicted data

  • r2 (float) – Coefficient of determination between simulated and predicted data

  • xlabel (str) – Text for the xlabel

  • ylabel (str) – Text fot the ylabel

  • rms (list) – Root mean square errors in the prediction of each value

  • storepath (str) – Path to store the plot, by default is stored in the execution directory

Auxiliar module

Auxiliar functions used in other modules

mlfompy.auxiliar.check_anomalous_data(fom)[source]

Detection of outliers data using the method: 1.5 times the interquartile distance

Parameters:

fom (list) – Figure of merit list to check outliers

Returns:

is_anomalous – Boolean: True for anomalous data, False for non anomalous data

Return type:

list

mlfompy.auxiliar.check_current_stability(i_drain, t_flight, sim_num, file=None)[source]

Checks if the currents of monte carlo fluctuate more than the 3% around the mean value

Parameters:
  • i_drain (list) – Drain currents from MC simulations

  • t_flight (list) – Flight times from MC simulations

Return type:

Boolean

mlfompy.auxiliar.check_empty_files(file)[source]

Checks if file is empty

Parameters:

file (list) – List of file paths

mlfompy.auxiliar.check_iv_dd_curve(fds, i)[source]

Checks if the curve iv of the jcjb file reaches an inflection point.

Parameters:
Return type:

Boolean

mlfompy.auxiliar.complete_maps_with_zeros(ler_map, n)[source]

Completes the maps with zeros to ensure equal dimensionality.

Parameters:
  • ler_map (list) – Profile data to complete with zeros

  • n (int) – Column dimensionality required for the ler maps

mlfompy.auxiliar.get_directories(fds, files, path, prefix=None)[source]

Imports the simulation directories to the MLFoMpyDataset.

Parameters:
  • fds (MLFoMpyDataset) –

  • files (list) – List of file paths path : path object Parent path where the simulations are stored

  • prefix (path object) – Original path for simulations stored in compressed repositories

mlfompy.auxiliar.iv_curve_dd_filter(fds, i)[source]

Filters the iv curve from DD simulation

Parameters:
Returns:

  • v_gate (list) – List of filtered gate voltages

  • i_drain (list) – List of filtered drain currents

mlfompy.auxiliar.iv_interpolation(fds, v_gate, i_drain, interpolation_points=10000)[source]

Constructs a cubic interpolation from the filtered iv curve from DD simulation. Depending on the drain bias (Vd)

Parameters:
  • fds (MLFoMpyDataset) –

  • v_gate (list) – List of filtered gate voltages

  • i_drain (list) – List of filtered drain currents

  • interpolation_points (int, fixed to 1000) – Number of points to interpolate

Returns:

  • quartic_interpol (scipy.interpolate.object) – Cubic interpolation of the iv_curve

  • x_interp (list) – List of the x interpolation values

  • delta_x_interp (float) – Step between two consecutive x_interp values

mlfompy.auxiliar.print_aux(msg_str)[source]

Display AUXILIAR message in green color

Parameters:

msg_str (str) – Auxiliar function message to display

mlfompy.auxiliar.print_error(msg_str)[source]

Display ERROR in red color

Parameters:

msg_str (str) – Warning message to display

mlfompy.auxiliar.print_fom_stats(fds)[source]

Display the figures of merit stats in blue color.

Parameters:

msg_str (str) – Warning message to display

mlfompy.auxiliar.print_out(msg_str)[source]

Display OUTPUTs in green color

Parameters:

msg_str (str) – Output message to display

mlfompy.auxiliar.print_sanity_stats(fds)[source]

Display the sanity checks stats in green color.

Parameters:

msg_str (str) – Warning message to display

mlfompy.auxiliar.print_title(msg_str)[source]

Display Tiltes in magenta color

Parameters:

msg_str (str) – Tilte message to display

mlfompy.auxiliar.print_warning(msg_str)[source]

Display WARNING in yellow color

Parameters:

msg_str (str) – Warning message to display

mlfompy.auxiliar.profiles_comparison(profile1, profile2)[source]

Compare if profile1 and profile2 are equal. This is important to generate the fom_to_json_ML().

Parameters:
  • profile1 (Path) – First profile to compare

  • profile2 (Path) – Second profile to compare

Returns:

Boolean

Return type:

True for identical profiles, False for different

mlfompy.auxiliar.save_json(path, output)[source]

Stores the output to json in path.

Parameters:
  • output (Dict) – Dictionary to store

  • path (Path) – File path to store the output

mlfompy.auxiliar.untar_to_tmp(sim_package, t_dir)[source]

Untar to temp folder the selected simulation .tgz

Parameters:
  • sim_package (path object) – Path of the compressed directories to extract

  • t_dir (path object) – Temporary directory where the extracted simulations are stored

Output files module

Functions to store data in files

mlfompy.output_files.ML_fom_iv_to_json_mgg(path, fds1, fds2=None, label=None)[source]

Stores the figures_of_merit, iv_curve and variability mgg profiles to a ml_maps.json. By default it is generated with one fds, but exists the option to include two fds, one for DD and other to MC matching Id’s.

Parameters:
  • path (Path) – Path to store the json file with the FoMs and statistics

  • fds1 (MLFoMpyDataset) –

  • fds2 (MLFoMpyDataset) –

  • method (str) –

    • Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’]

    • Extraction method used for ioff: [‘VG’]

    • Extraction method used for ss: [‘VGI’]

    • Extraction method used for ion_dd: [‘VG’]

    • Extraction method used for ion_mc: [‘VG’]

mlfompy.output_files.ML_fom_to_json_ler(path, fds1, fds2=None, width=None, label=None, n=400)[source]

Stores the figures_of_merit and variability ler profiles to a ml_maps.json. By default it is generated with one fds, but exists the option to include two fds, one for DD and other to MC matching Id’s.

Parameters:
  • path (Path) – Path to store the json file with the FoMs and statistics

  • fds1 (MLFoMpyDataset) –

  • fds2 (MLFoMpyDataset) –

  • width (float) – Value of the width/2 to subtract to the left column and add to the right column of the LER map: width=(Wch+2*Wox)/2 By default, if width is None, the value is extracted from the z4.out file

  • label (str) – str of the device

  • n (int) – Length required of the ler map, by default fixed to 400

mlfompy.output_files.ML_fom_to_json_mgg(path, fds1, fds2=None, label=None)[source]

Stores the figures_of_merit and variability mgg profiles to a ml_maps.json. By default it is generated with one fds, but exists the option to include two fds, one for DD and other to MC matching Id’s.

Parameters:
mlfompy.output_files.fom_to_json(path, fds1, fds2=None)[source]

Stores the figures_of_merit to a Figure_of_merit.json. By default it is generated with one fds, but exists the option to include two fds, one for DD and other to MC matching Id’s.

Parameters:
mlfompy.output_files.iv_fom_to_json(path, fds, fom=None, method=None)[source]

Stores the figures_of_merit and iv_curves from drift diffussion to a iv_fom_method_variability.json

Parameters:
  • path (Path) – Path to store the json file with the FoMs and statistics

  • fds (MLFoMpyDataset) –

  • fom (str) – Figure of merit to plot, accepted values: [‘vth’,’ioff’,’ss’,’ion_dd’, ‘ion_mc’]

  • method (str) –

    • Extraction method used for vth, accepted values: [‘SD’,’CC’,’LE’]

    • Extraction method used for ioff: [‘VG’]

    • Extraction method used for ss: [‘VGI’]

    • Extraction method used for ion_dd: [‘VG’]

    • Extraction method used for ion_mc: [‘VG’]