Some pysmurf functions are crashing in latest pysmurf release R7.3.1 due to deprecation of np.int in newer numpy version now being used in the dockers. E.g. get this error when trying to run S.read_adc_data or S.read_dac_data:
AttributeError Traceback (most recent call last)
Cell In[14], line 1
----> 1 S.read_adc_data(data_length=2**16, band=4, make_plot=True, show_plot=True)
File /usr/local/src/pysmurf/python/pysmurf/client/util/pub.py:50, in set_action.<locals>.dec.<locals>.wrapper(S, pub_action, *args, **kwargs)
46 S.pub._action = func.__name__
48 S.pub._action_ts = S.get_timestamp()
---> 50 rv = func(S, *args, **kwargs)
52 finally:
53 if is_top:
File /usr/local/src/pysmurf/python/pysmurf/client/util/smurf_util.py:1584, in SmurfUtilMixin.read_adc_data(self, band, data_length, hw_trigger, make_plot, save_data, timestamp, show_plot, save_plot, plot_ylimits)
1581 bay=self.band_to_bay(band)
1582 adc_number=band%4
-> 1584 self.setup_daq_mux('adc', adc_number, data_length,band=band)
1586 res = self.read_stream_data_daq(data_length, bay=bay,
1587 hw_trigger=hw_trigger)
1588 dat = res[1] + 1.j * res[0]
File /usr/local/src/pysmurf/python/pysmurf/client/util/pub.py:50, in set_action.<locals>.dec.<locals>.wrapper(S, pub_action, *args, **kwargs)
46 S.pub._action = func.__name__
48 S.pub._action_ts = S.get_timestamp()
---> 50 rv = func(S, *args, **kwargs)
52 finally:
53 if is_top:
File /usr/local/src/pysmurf/python/pysmurf/client/util/smurf_util.py:1780, in SmurfUtilMixin.setup_daq_mux(self, converter, converter_number, data_length, band, debug, write_log)
1777 daq_mux_channel1 = 23
1779 # setup buffer size
-> 1780 self.set_buffer_size(bay, data_length, debug)
1782 # input mux select
1783 self.set_input_mux_sel(bay, 0, daq_mux_channel0,
1784 write_log=write_log)
File /usr/local/src/pysmurf/python/pysmurf/client/util/pub.py:50, in set_action.<locals>.dec.<locals>.wrapper(S, pub_action, *args, **kwargs)
46 S.pub._action = func.__name__
48 S.pub._action_ts = S.get_timestamp()
---> 50 rv = func(S, *args, **kwargs)
52 finally:
53 if is_top:
File /usr/local/src/pysmurf/python/pysmurf/client/util/smurf_util.py:1807, in SmurfUtilMixin.set_buffer_size(self, bay, size, debug, write_log)
1805 self.set_data_buffer_size(bay, size, write_log=True)
1806 for daq_num in np.arange(2):
-> 1807 s = self.get_waveform_start_addr(bay, daq_num, convert=True,
1808 write_log=debug)
1809 e = s + 4*size
1810 self.set_waveform_end_addr(bay, daq_num, e, convert=True,
1811 write_log=debug)
File /usr/local/src/pysmurf/python/pysmurf/client/command/smurf_command.py:3225, in SmurfCommandMixin.get_waveform_start_addr(self, bay, engine, convert, **kwargs)
3219 val = self._caget(
3220 self.waveform_engine_buffers_root.format(bay) +
3221 self._start_addr_reg.format(engine),
3222 **kwargs)
3224 if convert:
-> 3225 return self.hex_string_to_int(val)
3226 else:
3227 return val
File /usr/local/src/pysmurf/python/pysmurf/client/util/smurf_util.py:2514, in SmurfUtilMixin.hex_string_to_int(self, s)
2500 def hex_string_to_int(self, s):
2501 """
2502 Converts hex string, which is an array of characters, into an int.
2503
(...)
2512 The 64 bit int.
2513 """
-> 2514 return np.int(''.join([chr(x) for x in s]),0)
File /usr/local/lib/python3.8/dist-packages/numpy/__init__.py:305, in __getattr__(attr)
300 warnings.warn(
301 f"In the future `np.{attr}` will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in __former_attrs__:
--> 305 raise AttributeError(__former_attrs__[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full `numpy.testing` namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Some pysmurf functions are crashing in latest pysmurf release R7.3.1 due to deprecation of
np.int
in newer numpy version now being used in the dockers. E.g. get this error when trying to runS.read_adc_data
orS.read_dac_data
: