API¶
This part covers the complete api documentation of the heatcapacity library.
heatcapacity
Package¶
from slave.transport import LinuxGpib
import heatcapacity as hc
# We use a Keithley model 6221 as current source,
source = hc.K6221CurrentSource(LinuxGpib(8))
# a Keithley model 2182A Nanovoltmeter to measure the voltage drop at the
# heater,
powermeter = hc.K2182Powermeter(LinuxGpib(9))
#and a lakeshore model 370 to determine the platform temperature.
thermometer = hc.LS370Thermometer(LinuxGpib(10))
# We sample at a rate of 0.1 s and use a step pulse with 1 uA to excite the
# system.
sampling_time = 0.1
pulse_sequence = [0.] * 60 * sampling_time + [1.] * 60 * sampling_time
# The PulseMeasurement object is used to acquire the data.
measurement = hc.PulseMeasurement(currentsource, powermeter, thermometer,
pulse, sampling_time)
timestamp, power, temperature = measurement.start()
# We fit a first order model to get the heat capacity.
model = hc.FirstOrderModel.fit(timestamp, temperature, power)
print('C {}; K {}'.format(model.heat_capacity, model.thermal_conductivity))
fit
module¶
-
class
heatcapacity.fit.
FirstOrder
(b, a)[source]¶ Bases:
scipy.signal.ltisys.lti
First order heat capacity differential equation model.
The first oder heat capacity differential equation is
C * dy/dt + K * y = uwith C the heat capacity, K the thermal conductivity, y the temperature and u the heater power. This is a special case of a linear time invariant first order system
a0 * dy/dt + a1 * y = b0 * du(t)/dt + b1 * u(t)The corresponding transferfunction is
b0 * s^1 + b1 * s^0- G(s) = ——————-
- a0 * s^1 + a1 * s^0
Note
We normalize the transfer function to a0 = 1. on instatiation.
Parameters: - b – Numerator polynom.
- a – Denominator polynom.
-
classmethod
fit
(t, y, u)[source]¶ Fits a first order heat capacity model.
Parameters: - t – A sequence of timestamps.
- y – A sequence of temperatures.
- u – A sequence of heater power values.
-
heat_capacity
¶
-
thermal_conductivity
¶
measure
module¶
-
class
heatcapacity.measure.
CurrentSource
[source]¶ Bases:
future.types.newobject.newobject
Abstract base class defining the current source interface.
-
current
¶
-
-
class
heatcapacity.measure.
Measurement
(currentsource, powermeter, thermometer)[source]¶ Bases:
future.types.newobject.newobject
Abstract base class defining the heat capacity measurement interface.
Parameters: - currentsource – An object implementing the
CurrentSource
interface. - powermeter – An object implementing the
Powermeter
interface. - thermometer – An object implementing the
Thermometer
interface.
- currentsource – An object implementing the
-
class
heatcapacity.measure.
Powermeter
[source]¶ Bases:
future.types.newobject.newobject
Abstract base class defining the powermeter interface.
-
voltage
¶
-
-
class
heatcapacity.measure.
PulseMeasurement
(currentsource, powermeter, thermometer, pulse, sampling_time)[source]¶ Bases:
heatcapacity.measure.Measurement
A heat capacity measurement using a predefined pulse sequence.
Parameters: - currentsource – An object implementing the
CurrentSource
interface. - powermeter – An object implementing the
Powermeter
interface. - thermometer – An object implementing the
Thermometer
interface. - pulse – A sequence of current values.
- sampling_time – The sampling time.
- currentsource – An object implementing the
simulation
module¶
-
class
heatcapacity.simulation.
Simulation
(model, heater_resistance, noise_level)[source]¶ Bases:
object
The Simulation object can be used if a real experiment is not available.
Parameters: - model – An lti model used to simulate the temperature output.
- heater_resistance – A resistance in ohm used to calculate the voltage drop.
- noise_level – A sample taken from the standard normal distribution scaled by the noise_level is added to the simulated temperature output.
E.g.:
import heatcapacity as hc sim = hc.Simulation( hc.FirstOrder.from_ck(0.005, 0.002), heater_resistance=1e3, temperature_noise=0.1 ) sampling_time = 0.1 pulse_sequence = [0.] * 60 * sampling_time + [1.] * 60 * sampling_time measurement = hc.PulsMeasurement( currentsource=sim, powermeter=sim, thermometer=sim, pulse=pulse_sequence, sampling_time=sampling_time) measurement.start()
-
temperature
¶ Simulates the temperature response to the current change.
-
voltage
¶