<jupyter_start><jupyter_text>chaogate> Simulations of the 3-MOSFET system known as a `choagate` using `pyspice`. This library corresponds to a selection of the code used in *Chaogate Parameter Optimization using Bayesian Optimization and Genetic Algorithm, AI for Hardware Security, ISQED21, 4/7/2020*.  Install `pip install chaogate`  How to use<jupyter_code>import chaogate
from chaogate import *<jupyter_output><empty_output><jupyter_text>Ensure you change the `global_path` to the folder containing the as described in the `core` page.By default, they point to:<jupyter_code>global_path<jupyter_output><empty_output><jupyter_text>We can instantiate a chaogate with the `chaogate` function, though this is automatically called by all the other functions which need it in this library. Most functions, such as `sweep`, `grid`, and `bifurcate`, accept `kwargs` as an argument, which refers to all the possible keyword arguments of the `choagate` netlist. For exmaple,<jupyter_code>s1,s2=sweep(Vbias=(0,1.2,0.01),TEMP=(-20,120,20))
plot_sweep(s1,ncurves=10)
plot_sweep(s2,ncurves=10)<jupyter_output>sweep : Elapsed time: 0.3080 seconds<jupyter_text>Once we sweep, we calculate the relevant chaotic properties using `iterate`.This is packaged into an automatic process, along with calculating the `lyapunov` exponent, with the `bifurcate` function.We can calculate these quantities over entire regions of parameter space with functions like `grid`, then estimate the computational stability with `boolean_divergence`:<jupyter_code>g=bifurcate(Vbias=(0,1.2,0.01),Vdd=(1.15,1.25,0.001),as_grid=True)
plot_bifurcate(itr=g.iterate.sel(Vdd=1.2),lya=g.lyapunov.sel(Vdd=1.2))
grad = boolean_gradient(g.iterate)
div = boolean_divergence(grad)
plt.matshow(div)
plt.colorbar()<jupyter_output><empty_output><jupyter_text>We can quickly compare the difference between the desired chaotic properties (positive lyapunov), and the undesirable properties (the boolean divergence) by taking a linear combination such as:<jupyter_code>normalized_lyapunov = (g.lyapunov.data>0)*g.lyapunov.data/np.max(g.lyapunov.data)
normalized_divergence = div/np.max(div) 
optimizer = normalized_lyapunov - normalized_divergence 
plt.matshow(optimizer)
plt.colorbar()<jupyter_output><empty_output><jupyter_text>With an appropriate optimizatier we can then begin to assess the appropriate chaogate design<jupyter_code>sidis.refresh()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09390444810543658, 'fraction_numerical': 0.023064250411861616, 'mean_word_length': 7.675, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 26, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '269346', 'license': 'Apache-2.0', 'n_tokens_mistral': 853, 'n_tokens_neox': 795, 'n_words': 227, 'path': 'index.ipynb', 'repo_name': 'Noeloikeau/chaogate', 'size': '2428'}