def test_value(self): a = np.array([1, 2, 3, 4]) b = Value.array_like(array=a, unit=ureg.amp) print(b[0]) a = np.array([[1, 2, 3, 4], [1, 2, 3, 4]]) b = Value.array_like(array=a, unit=ureg.amp) print(b[0][0]) f = Field(field='voltage', name='nothing') print(f) a = Value(value=3.0, unit=ureg.amp, name='input_voltage', tf_shape=(None, 1)) c = 1 / a array = np.array([a, a, a], dtype=object) b = Value(value=2.0, unit=ureg.volt * ureg.volt, name='input_current') d = ureg.amp * array r = array * b f = b * array boo = r == f tmep = 1.0 * ureg.volt f = 2.0 * ureg.microvolt temp = tmep + f temp = tmep.to_reduced_units() d = a * 2.0 f = 2.0 * a c = 1.0 r = 1.0 * ureg.volt t = ureg.volt * 1.0 d = a == b r = a.tensor d = 5
def test_value(self): # test the array_like function a = np.array([1, 2, 3, 4]) b = Value.array_like(array=a, unit=ureg.amp) self.assertEquals(Value(1, ureg.amp), b[0], 'Error in Value.array_like()') a = np.array([[1, 2, 3, 4], [1, 2, 3, 4]]) b = Value.array_like(array=a, unit=ureg.amp) self.assertEquals(Value(1, ureg.amp), b[0][0], 'Error in Value.array_like()') # test math operations a = Value(1, ureg.amp) a_n = 1 b = Value(2, ureg.amp) c = Value(3, ureg.amp) d = Value(4, ureg.volt) e = Value(2, ureg.ohm) # test the add function self.assertEqual(c, a + b, 'Error in Value.__add__()') # test the subtract function self.assertEqual(c - b, a, 'Error in Value.__sub__()') # test the multiply function self.assertEqual(d, b * e, 'Error in Value.__mul__()') self.assertEqual(a, a * a_n, 'Error in Value.__mul__()') # test the divide function self.assertEqual(d / e, b, 'Error in Value.__truediv__()') self.assertEqual(a, a / a_n, 'Error in Value.__truediv__()') f = Field(field='voltage', name='nothing') print(f) a = Value(value=3.0, unit=ureg.amp, name='input_voltage', tf_shape=(None, 1)) c = 1 / a array = np.array([a, a, a], dtype=object) b = Value(value=2.0, unit=ureg.volt * ureg.volt, name='input_current') d = ureg.amp * array r = array * b f = b * array boo = r == f tmep = 1.0 * ureg.volt f = 2.0 * ureg.microvolt temp = tmep + f temp = tmep.to_reduced_units() d = a * 2.0 f = 2.0 * a c = 1.0 r = 1.0 * ureg.volt t = ureg.volt * 1.0 d = a == b r = a.tensor d = 5
def test_tlmextraction(self): # path = '/home/connor/Documents/Stanford_Projects/Extractions/src/SampleData/FETExampleData/nano_patterning.csv' # idvg_path = '/home/connor/Documents/Stanford_Projects/Extractions/fetextraction/SemiPy/SampleData/TLMExampleData' idvg_path = '/home/connor/Documents/Stanford_Projects/Extractions/SemiPy/SampleData/TLMExampleDataShort' # idvg_path = '/home/connor/Documents/Stanford_Projects/Extractions/fetextraction/SemiPy/SampleData/TLMExampleDataShort' # idvd_path = '/home/connor/Documents/Stanford_Projects/Extractions/fetextraction/SemiPy/SampleData/FETExampleData/WSe2_Sample_4_Id_Vd.txt' # idvg_path = '/home/connor/Documents/Stanford_Projects/Extractions/fetextraction/SemiPy/SampleData/FETExampleData/WSe2_Sample_4_Id_Vg.txt' widths = Value(4.0, ureg.micrometer) # lengths = Value.array_like(np.array([0.5, 1.0, 2.0, 2.5, 3.0, 3.5]), unit=ureg.micrometer) lengths = Value.array_like(np.array([1.0, 0.5, 2.0]), unit=ureg.micrometer) tox = Value(90, ureg.nanometer) result = TLMExtractor(widths=widths, lengths=lengths, tox=tox, epiox=3.9, device_polarity='n', idvg_path=idvg_path, vd_values=[1.0, 2.0]) result.save_tlm_plots() a = 5
def __init__(self, min_value, max_value, unit, num=None, step=None, *args, **kwargs): assert num is not None or step is not None, 'You must give a step or num value' if num is not None: self.range = np.linspace(min_value, max_value, num) elif step is not None: self.range = np.arange(min_value, max_value, step) self.range = Value.array_like(self.range, unit=unit)
def test_tlmextraction(self): # Change these filepaths to match TLM data idvd_path = get_abs_semipy_path( 'SampleData/TLMExampleData/WSe2_Sample_4_Id_Vd.txt') # unused idvg_path = get_abs_semipy_path('SampleData/TLMExampleData') widths = Value(4.0, ureg.micrometer) lengths = Value.array_like(np.array([0.5, 1.0, 2.0, 2.5, 3.0, 3.5]), unit=ureg.micrometer) #lengths = Value.array_like(np.array([1.0, 2.0, 0.5]), unit=ureg.micrometer) #lengths = Value.array_like(np.array([2.0, 0.5, 1.0]), unit=ureg.micrometer) gate_oxide = SiO2(thickness=Value(30, ureg.nanometer)) channel = MoS2(layer_number=1) result = TLMExtractor(widths=widths, lengths=lengths, gate_oxide=gate_oxide, channel=channel, FET_class=nTFT, idvg_path=idvg_path, vd_values=[1.0, 2.0], substrate=Silicon()) result.save_tlm_plots()
import unittest from SemiPy.Extractors.TLM.TLMExtractor import TLMExtractor from SemiPy.Devices.Devices.FET.ThinFilmFET import nTFT from SemiPy.Devices.Materials.Oxides.MetalOxides import SiO2 from SemiPy.Devices.Materials.Semiconductors.BulkSemiconductors import Silicon from SemiPy.Devices.Materials.TwoDMaterials.TMD import MoS2 from SemiPy.helper.paths import get_abs_semipy_path from physics.value import Value, ureg import numpy as np idvd_path = get_abs_semipy_path( 'SampleData/TLMExampleData/WSe2_Sample_4_Id_Vd.txt') # unused idvg_path = get_abs_semipy_path('SampleData/TLMExampleData') widths = Value(4.0, ureg.micrometer) lengths = Value.array_like(np.array([0.5, 1.0, 2.0, 2.5, 3.0, 3.5]), unit=ureg.micrometer) gate_oxide = SiO2(thickness=Value(30, ureg.nanometer)) channel = MoS2(layer_number=1) result = TLMExtractor(widths=widths, lengths=lengths, gate_oxide=gate_oxide, channel=channel, FET_class=nTFT, idvg_path=idvg_path, vd_values=[1.0, 2.0], substrate=Silicon()) result.save_tlm_plots()
def __extract_data(self): """ Extract the properties of the FET given the available data, including transconductance (gm), subthreshold swing (ss), field-effect mobility (mufe), threshold voltage (vt), max on current (max_Ion), min off current at max Ion Vd (min_Ioff), Returns: None """ print('starting extraction') # now compute the vt and gm using the max Vd vd = self.idvg.get_secondary_indep_values() # adjust the shape to be [num_set, 1] vd = Value.array_like(np.expand_dims(np.array(vd), axis=-1), unit=ureg.volt) max_vd = max(vd) vg = self.idvg.get_column('vg') max_vg = self.FET.max_value(vg) # get the max and min Ion ion = self.idvg.get_column('id') max_ion, max_ion_i = self.FET.max_value(ion, return_index=True) max_ion_vd = vd[max_ion_i[0], 0] max_ion_vg = vg[max_ion_i] self.FET.max_Ion.set(value=max_ion, input_values={ 'Vg': max_ion_vg, 'Vd': max_ion_vd }) # compute the gm gm_fwd, max_gm_fwd, max_gm_fwd_i = self._extract_gm(fwd=True, return_max=True) gm_bwd, max_gm_bwd, max_gm_bwd_i = self._extract_gm(bwd=True, return_max=True) gm = np.concatenate((gm_fwd, gm_bwd), axis=-1) self.idvg.add_column(column_name='gm', column_data=gm) max_gm, max_gm_i = self.FET.max_slope_value( self.idvg.get_column(column_name='gm'), return_index=True) max_gm_vd = vd[max_gm_i[0], 0] max_gm_input_values = { 'Vg': self.idvg.get_column_set('vg', max_gm_vd)[max_gm_i[-1]], 'Vd': max_gm_vd } self.FET.max_gm.set(max_gm, max_gm_input_values) # print('set gm') # Now extract the Vt values vt_fwd = self._extract_vt(index=max_gm_fwd_i, max_gm=max_gm_fwd, fwd=True) vt_bwd = self._extract_vt(index=max_gm_bwd_i, max_gm=max_gm_bwd, bwd=True) self.FET.Vt_fwd.set(vt_fwd) self.FET.Vt_bwd.set(vt_bwd) # compute the ss ss = self._slope(y_data=self.idvg.get_column('vg'), x_data=np.log10(self.idvg.get_column('id')), keep_dims=True) self.idvg.add_column(column_name='ss', column_data=ss) self.FET.min_ss = ss # print('computing properties') self.FET.compute_properties() # print('adjusting n') # now compute the carrier density n = self.FET.vg_to_n(self.idvg.get_column('vg')) self.idvg.add_column('n', n) # print('adding r') # now compute the resistance r = vd / self.idvg.get_column('id') self.idvg.add_column('resistance', r)
def _plot_line(self, x_min, x_max, a, b): x_data = Value.array_like(array=np.linspace(x_min, x_max), unit=x_min.unit) y_data = x_data * a + b plt.plot(x_data, y_data)
def _convert_to_value(unit): # creates a lambda function for converting values to a unit return lambda x: Value.array_like(x, unit=unit)