1
- # electronics.py ---
2
- #
1
+ # electronics.py ---
2
+ #
3
3
# Filename: electronics.py
4
- # Description:
4
+ # Description:
5
5
# Author: Subhasis Ray
6
- # Maintainer:
7
- # Created: Wed Feb 22 00:53:38 2012 (+0530)
8
- # Version:
9
- # Last-Updated: Tue Jul 10 10:28:40 2012 (+0530)
10
- # By: subha
11
- # Update #: 221
12
- # URL:
13
- # Keywords:
14
- # Compatibility:
15
- #
16
- #
6
+ # Maintainer: Dilawar Singh
17
7
18
- # Commentary:
19
- #
20
- #
21
- #
22
- #
23
-
24
- # Change log:
25
- #
26
- # 2012-02-22 23:22:30 (+0530) Subha - the circuitry put in a class.
27
- #
28
-
29
- # Code:
30
-
31
- import numpy
8
+ import numpy as np
32
9
import moose
33
10
34
11
class ClampCircuit (object ):
35
12
"""Container for a Voltage-Clamp/Current clamp circuit."""
13
+
36
14
defaults = {
37
15
'level1' : 25.0 ,
38
16
'width1' : 50.0 ,
@@ -51,21 +29,21 @@ def __init__(self, path, squid):
51
29
self .pulsegen .firstDelay = 2.0
52
30
self .pulsegen .secondDelay = 0.0
53
31
self .pulsegen .trigMode = 2
54
- self .gate = moose .PulseGen (path + "/gate" ) # holding voltage/current generator
32
+ self .gate = moose .PulseGen (path + "/gate" ) # holding voltage/current generator
55
33
self .gate .level [0 ] = 1.0
56
34
self .gate .delay [0 ] = 0.0
57
35
self .gate .width [0 ] = 1e9
58
- moose .connect (self .gate , ' output' , self .pulsegen , ' input' )
59
- self .lowpass = moose .RC (path + "/lowpass" ) # lowpass filter
36
+ moose .connect (self .gate , " output" , self .pulsegen , " input" )
37
+ self .lowpass = moose .RC (path + "/lowpass" ) # lowpass filter
60
38
self .lowpass .R = 1.0
61
39
self .lowpass .C = 0.03
62
- self .vclamp = moose .DiffAmp (path + "/vclamp" )
40
+ self .vclamp = moose .DiffAmp (path + "/vclamp" )
63
41
self .vclamp .gain = 0.0
64
42
self .vclamp .saturation = 1e10
65
- self .iclamp = moose .DiffAmp (path + "/iclamp" )
43
+ self .iclamp = moose .DiffAmp (path + "/iclamp" )
66
44
self .iclamp .gain = 0.0
67
45
self .iclamp .saturation = 1e10
68
- self .pid = moose .PIDController (path + "/pid" )
46
+ self .pid = moose .PIDController (path + "/pid" )
69
47
self .pid .gain = 0.5
70
48
self .pid .tauI = 0.02
71
49
self .pid .tauD = 0.005
@@ -82,8 +60,18 @@ def __init__(self, path, squid):
82
60
current_table = moose .Table ("/data/Im" )
83
61
moose .connect (current_table , "requestOut" , squid .C , "getIm" )
84
62
85
- def configure_pulses (self , baseLevel = 0.0 , firstLevel = 0.1 , firstDelay = 5.0 , firstWidth = 40.0 , secondLevel = 0.0 , secondDelay = 1e6 , secondWidth = 0.0 , singlePulse = True ):
86
- """Set up the pulse generator."""
63
+ def configure_pulses (
64
+ self ,
65
+ baseLevel = 0.0 ,
66
+ firstLevel = 0.1 ,
67
+ firstDelay = 5.0 ,
68
+ firstWidth = 40.0 ,
69
+ secondLevel = 0.0 ,
70
+ secondDelay = 1e6 ,
71
+ secondWidth = 0.0 ,
72
+ singlePulse = True ,
73
+ ):
74
+ """Set up the pulse generator."""
87
75
self .pulsegen .baseLevel = baseLevel
88
76
self .pulsegen .firstLevel = firstLevel
89
77
self .pulsegen .firstWidth = firstWidth
@@ -92,10 +80,10 @@ def configure_pulses(self, baseLevel=0.0, firstLevel=0.1, firstDelay=5.0, firstW
92
80
self .pulsegen .secondDelay = secondDelay
93
81
self .pulsegen .secondWidth = secondWidth
94
82
if singlePulse :
95
- self .pulsegen .trigMode = 1
83
+ self .pulsegen .trigMode = 1
96
84
else :
97
85
self .pulsegen .trigMode = 0
98
-
86
+
99
87
def do_voltage_clamp (self ):
100
88
"""Switch to voltage clamp circuitry. After this the simdt may
101
89
need to be changed for correct performance."""
@@ -104,14 +92,10 @@ def do_voltage_clamp(self):
104
92
self .pid .gain = 0.5
105
93
self .pid .tauD = 0.005
106
94
self .pid .tauI = 0.02
107
-
95
+
108
96
def do_current_clamp (self ):
109
97
"""Switch to current clamp circuitry. After this the simdt may
110
98
need to be changed for correct performance."""
111
99
self .iclamp .gain = 1.0
112
100
self .vclamp .gain = 0.0
113
101
self .pid .gain = 0.0
114
-
115
-
116
- #
117
- # electronics.py ends here
0 commit comments