Comments (10)
A bit more information. I was originally seeing this error on the last line here:
cxn = sample._cxn
adr = cxn.adr_server
sample['magnet_current'] = adr.magnet_status()[0]
sample['magnet_voltage'] = adr.magent_status()[1]
so I refactored to only call the adr server once, but the error persisted.
mag_status = adr.magnet_status()
sample['magnet_current'] = adr.mag_status[0]
sample['magnet_voltage'] = adr.mag_status[1]
finally I put this in a try-except to try and catch the issue, and that is when the error starting being thrown at line 315 like I showed in the first post:
bad_mag_status = True
while bad_mag_status:
time.sleep(0.1)
try:
mag_status = adr.magnet_status()
sample['magnet_current'] = mag_status[0]
sample['magnet_voltage'] = mag_status[1]
bad_mag_status = False
except:
bad_mag_status = True
from scalabrad.
@BrooksCampbell, I don't quite understand the flow here. Are you saying that the adr.magnet_status()
call happens, then later you call sample['iq_calibration_dataset']
and get the error above about NoneType
? If that is the case, what error, if any was being thrown by the call to adr.magnet_status
? For example, if you could change the except clause to not swallow the exception that would be really helpful, e.g.
try:
...
except Exception:
import traceback
print "Error getting magnet status"
traceback.print_exc()
bad_mag_status = True
That may give a hint as to what is going on.
Also FWIW it seems like this is probably a problem with pylabrad, rather than scalabrad, but I guess we can't say yet for sure.
from scalabrad.
I'm doing a magnet cycle and then I'll try running the code with your traceback code in the exception during the group meeting.
The code that sets this magnet_voltage key is in update_adr_temperature_keys:
https://github.com/BrooksCampbell/brooks_code/blob/master/Impulse_response_noDMMs.py#L483
def update_adr_temperature_keys(sample):
cxn = sample._cxn
adr = cxn.adr_server
adr_devices = adr.list_devices()
adr.select_device()
sample['adr'] = '%s'%adr_devices
temperatures = adr.temperatures()
sample['50K_temp'] = temperatures[0]
sample['4K_temp'] = temperatures[1]
sample['4K_mag_Temp'] = temperatures[2]
ruox = adr.ruox_status()
sample['ruox_temp'] = ruox[0]
sample['ruox_resistance'] = ruox[1]
bad_mag_status = True
while bad_mag_status:
time.sleep(0.1)
try:
mag_status = adr.magnet_status()
sample['magnet_current'] = mag_status[0]
sample['magnet_voltage'] = mag_status[1]
bad_mag_status = False
except:
bad_mag_status = True
I call this code once before each of my scans to pull the current adr temperatures and magnet status.
When I put the magnet code in a try-except, then I still got the same error at line 315 in my main function step_response:
https://github.com/BrooksCampbell/brooks_code/blob/master/Impulse_response_noDMMs.py#L301
...
update_adr_temperature_keys(sample)
print 'DIR: {}'.format(sample['iq_calibration_directory'])
print 'Dataset: {}'.format(sample['iq_calibration_dataset'])
...
Oddly the error occurs on the third line "print 'Dataset: {}'..." and not the next time I access the registry (on the line above) "print 'DIR: {}'..."
from scalabrad.
How often does this happen?
from scalabrad.
In my code, it seems once every 20-100 iterations. I wrote a test code to just set a random value to that key and then read it back, and that ran 10k times without issue.
from scalabrad.
I've been unsuccessful reproducing the error outside of my larger code.
I've run this segment accessing just the adr.magnet_status(), several hundred times without issue:
count = 0
while count<100:
bad_mag_status = True
count += 1
while bad_mag_status:
time.sleep(0.1)
try:
mag_status = adr.magnet_status()
sample['magnet_current'] = mag_status[0]
sample['magnet_voltage'] = mag_status[1]
bad_mag_status = False
except Exception:
import traceback
print "Error getting magnet status"
traceback.print_exc()
bad_mag_status = True
count = 999
same for this segment, using the same update_adr_temperature_keys function, still okay for the couple hundred iterations I've tried.
import Impulse_response_noDMMs as ip
count = 0
while count<100:
bad_mag_status = True
count += 1
print 'count: {}'.format(count)
print 'count: {}'.format(count)
print 'count: {}'.format(count)
print 'count: {}'.format(count)
while bad_mag_status:
time.sleep(0.1)
try:
ip.update_adr_temperature_keys(sample)
bad_mag_status = False
except Exception:
import traceback
print "Error getting magnet status"
traceback.print_exc()
bad_mag_status = True
count = 999
from scalabrad.
I continued running that second segment several hundred times and I've gotten the error once and it was at a different key:
Error getting magnet status
Traceback (most recent call last):
File "<ipython-input-39-c766e2541935>", line 13, in <module>
ip.update_adr_temperature_keys(sample)
File "Impulse_response_noDMMs.py", line 496, in update_adr_temperature_keys
sample['ruox_temp'] = ruox[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
from scalabrad.
For the sake of getting data tonight, I'm going to remove the update_adr_temperature_keys function call from my code and just call that once every couple minutes in a different window to update the temperatures for my data logging.
from scalabrad.
It ran about 200 times last night before the code, with the update_adr_temperature_keys call errored when I accessed the start_scope_voltage registry key on line 348:
https://github.com/BrooksCampbell/brooks_code/blob/master/Impulse_response_noDMMs.py#L348
Unfortunately my remote desktop session wont let me type in that ipython window now so I can't 'debug' to see what the util key was that caused the issue. I left it open and I'll try to get that information later.
In case this is related, I do have a different script running in another ipython window on the same computer that accesses the ADR server (the same temperature and magnet status calls), and the lockin amplifier. It has not had trouble, but it also does not access the registry other than when it first starts.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-2d50a6297b81> in <module>()
----> 1 ip.cal_and_step_sweep(s, lo_frequencies = [6.4 * GHz, 5.5 * GHz, 4.6 * G
Hz], cal_averages = 100, step_averages = 1000)
U:\Brooks\Code\Impulse_response_noDMMs.py in cal_and_step_sweep(sample, lo_frequ
encies, dac_amps, lo_powers, step_frequencies, cal_averages, step_averages)
196 end_fluxes=np.linspace(0.2
, 0.7,
197 51)
,
--> 198 frequency=step_frequency)
199
200
U:\Brooks\Code\Impulse_response_noDMMs.py in sweep_step(sample, start_flux, end_
fluxes, averages, plot, horizontal_scale, frequency, config)
240 end_flux),
241 horizontal_scale=horizontal_scale,
--> 242 frequency=frequency, config=config)
243
244
U:\Brooks\Code\Impulse_response_noDMMs.py in step_response(sample, start_flux, e
nd_flux, averages, plot, horizontal_scale, frequency, name, config)
346 start_scope_voltage = flux_to_scope_voltage(start_flux, calibration_
data)
347 end_scope_voltage = flux_to_scope_voltage(end_flux, calibration_data
)
--> 348 sample['start_scope_voltage'] = start_scope_voltage
349 sample['end_scope_voltage'] = end_scope_voltage
350
C:\pyle\pyle\util\registry.pyc in __setitem__(self, name, value)
288 as needed.
289 """
--> 290 self._update()
291 if name in self:
292 msg = "__setitem__ {} to {} from {} in path {}".format(
C:\pyle\pyle\util\registry.pyc in _update(self)
235 elif now_connected:
236 if updated_keys:
--> 237 self._update_keys(updated_keys)
238 else:
239 log.warn("registry is not connected. cache state may be inva
lid!")
C:\pyle\pyle\util\registry.pyc in _update_keys(self, keys)
157 result = p.send()
158 for k in keys:
--> 159 self._keys[k] = result[k]
160
161 def _handle_server_connect(self, message_ctx, msg):
TypeError: 'NoneType' object has no attribute '__getitem__'
from scalabrad.
Traced this down to an issue in pylabrad (labrad/pylabrad#271) so going to close this.
from scalabrad.
Related Issues (20)
- Noticed a typo in labrad.bat that prevents execution. HOT 3
- scalabrad on raspberry pi HOT 1
- Broken link in binary download HOT 1
- Need way to kill server/client connection HOT 3
- Need better information on manager connection list HOT 2
- how to compile the scala project? HOT 2
- Registry changes do not always save
- Connection.newContext returns default context on first call
- Occasional NPE in tests when Listener fails to start
- Auth server gives nonsense error when trying to change settings from non-local manager
- Error message with "server already connected" when it's not connected
- Memory leak when multiheaded servers fail to connect
- Node can sometimes lose track of processes HOT 1
- Human readable version of sqlite Registry blob data HOT 2
- java 8 missing error message unclear HOT 2
- LabRAD upgrade issue: directory .dir extension, can one avoid it? HOT 1
- LabRAD upgrade issue: labrad-migrate-registry doesn't work with string HOT 6
- LabRAD manager fails to start when pointed to the old registry (and a funny workaround) HOT 3
- trouble starting labrad manager HOT 1
- labrad manager shutting down HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalabrad.