```python
import matplotlib.pyplot as plt
import numpy as np
from pint import UnitRegistry
unit = UnitRegistry()
unit.formatter.default_format = "~"
unit.setup_matplotlib()


gain_first_stage = 10e6 * unit.V / unit.A
gain_second_stage = 100e3 / 1e3

tunnel_current_in = np.linspace(1e-12, 10e-9, 100) * unit.A
volts_out = tunnel_current_in * gain_first_stage * gain_second_stage

plt.xscale("log")
plt.plot(tunnel_current_in, volts_out)
xticks = [1e-12, 10e-12, 100e-12, 1e-9, 10e-9] * unit.A
plt.xticks(xticks, [f'{t.to("nA"):.3f~}' for t in xticks], minor=False)
plt.xlabel("Tunneling Current")

plt.yscale("log")
yticks = [0.001, 0.010, 0.1, 1.0, 5] * unit.V
plt.yticks(yticks, [f'{t.to("V"):.3f~}' for t in yticks], minor=False)
plt.ylabel("Preamp Voltage")
plt.grid(True, "both")
```


    
![png](Preamp-Current_files/Preamp-Current_0_0.png)
    



```python
v = 0.359 * unit.V
a = v / (gain_first_stage * gain_second_stage)
a.to("pA")
```




359.0 pA




```python

```
