Closed Bramhand closed 3 years ago
Hi Bramhand
I would suggest taking a look at this example.
https://github.com/SINGROUP/PyVAFM/blob/cCore/examples/LockInTest.py
John
Hello John,
Thank you very much. I tried to run the following Lockintest code and there is a key error pop-up. I am trying to solve it, but I need your help.
The error is following;
**PY: circuit Ymul(opMul) created.
??pushed True
??type opMul
PY: circuit Ymul(opMul) initiated.
Traceback (most recent call last):
File "lockintest.py", line 18, in <module>
machine.AddCircuit(type="Machine",name='LockInAmp', intTime=1.0/f0 * 1000, CentFreq=f0, Ampgain=2 ,assembly=LockInAmp, pushed=True)
File "/cygdrive/C/Users/Dhaval/Documents/PyVAFM-cCore/src/vafmcircuits.py", line 419, in AddCircuit
instance = classobj[1](machine=self, **argkw)
File "/cygdrive/C/Users/Dhaval/Documents/PyVAFM-cCore/src/vafmcircuits.py", line 168, in __init__
self.Assemble(self,**keys)
File "/cygdrive/C/Users/Dhaval/Documents/PyVAFM-cCore/src/customs.py", line 345, in LockInAmp
compo.AddCircuit(type='opMul',name='gain', pushed=True,in2=keys["OutAmp"])
KeyError: 'OutAmp'**
-Dhaval
Ah, it looks like the example was not updated for some reason. You are missing out OutAmp in the machine.addcircuit for the Lock InAmp.
Below is an example of what it should look like, try that and see how you get on.
machine.AddCircuit(type="Machine",name='LockInAmp', intTime=1.0/f0 * 100, CentFreq=f0, OutAmp=Az , Gain=2 ,assembly=LockInAmp, pushed=True)
thank you for the prompt reply. I tried and another key error pop-up on 'Signal' defined in machine.connect('wavegen.cos', 'LockInAmp-Signal').
Traceback (most recent call last):
File "lockintest.py", line 27, in <module>
machine.Connect('WaveGen.cos','LockInAmp.Signal')
File "/cygdrive/C/Users/Dhaval/Documents/PyVAFM-cCore/src/vafmcircuits.py", line 703, in Connect
target = self._GetInternalChannel(tag, ChannelType.Input)
File "/cygdrive/C/Users/Dhaval/Documents/PyVAFM-cCore/src/vafmcircuits.py", line 470, in _GetInternalChannel
return allchs[chname]
KeyError: 'Signal'
I think it should be signal, not Signal.
I suspect the example was again not updated sorry.
No problem. It works.
There is similar problem appears with capital letter.
does not work-out1.Register('summer.out','LockInAmp.Amp')
Works-out1.Register('summer.out','LockInAmp.amp')
Now it is running smoothly. I was thinking it does not make difference on captial or small chaeraters. I will keep in mind.
Thanks.
Good good, when I get a sec I shall update it.
Can you please give an example of how to add Lock in Amplifier circuit? I am a newbie using PyVAFM.