diff --git a/src/pycbsdk/cbhw/device/base.py b/src/pycbsdk/cbhw/device/base.py index 3a78149..aa5505e 100644 --- a/src/pycbsdk/cbhw/device/base.py +++ b/src/pycbsdk/cbhw/device/base.py @@ -30,6 +30,7 @@ def __init__(self, params: Params): ), # Filled in upon receiving device config. "proc_chans": 0, "instrument": -1, + "b_gemini": False, "channel_infos": {}, "group_infos": {}, "group_nchans": {}, diff --git a/src/pycbsdk/cbhw/device/nsp.py b/src/pycbsdk/cbhw/device/nsp.py index ca95b24..c05f7b4 100644 --- a/src/pycbsdk/cbhw/device/nsp.py +++ b/src/pycbsdk/cbhw/device/nsp.py @@ -488,6 +488,7 @@ def _handle_procinfo(self, pkt): prot_str = f"{vmaj}.{vmin}" logger.info(f"Protocol version {prot_str}") self._config["proc_chans"] = pkt.chancount + self._config["b_gemini"] = hasattr(pkt, "ident") and "gemini" in pkt.ident.lower() # config.protocol = prot_str # Too late; we already loaded our factory if we got this far. def _handle_nplay(self, pkt): diff --git a/src/pycbsdk/examples/group_sample_intervals.py b/src/pycbsdk/examples/group_sample_intervals.py index e2e0d61..e07ec2d 100644 --- a/src/pycbsdk/examples/group_sample_intervals.py +++ b/src/pycbsdk/examples/group_sample_intervals.py @@ -87,14 +87,8 @@ def main( for ch in range(1, nchans + 1): _ = cbsdk.set_channel_config(nsp_obj, ch, "smpgroup", smpgroup) - # Calculate the clock step (I hate this) - if inst_addr and int(inst_addr.split(".")[-1]) in [200, 201, 202, 203, 203]: - # Note: This misses Gemini NSP! - t_step = 1 / 1e9 - else: - t_step = 1 / config["sysfreq"] - # Create a dummy app. + t_step = 1 / (1e9 if config["b_gemini"] else config["sysfreq"]) app = DummyApp(nchans, duration=duration, t_step=t_step) time.sleep(2.0) diff --git a/src/pycbsdk/examples/print_rates.py b/src/pycbsdk/examples/print_rates.py index 8588280..0a7c5f7 100644 --- a/src/pycbsdk/examples/print_rates.py +++ b/src/pycbsdk/examples/print_rates.py @@ -177,14 +177,8 @@ def main( ] n_chans = sum(b_spk) - # Calculate the clock step (I hate this) - if inst_addr and int(inst_addr.split(".")[-1]) in [200, 201, 202, 203, 203]: - # Note: This misses Gemini NSP! - t_step = 1 / 1e9 - else: - t_step = 1 / config["sysfreq"] - # Create the dummy app. + t_step = 1 / (1e9 if config["b_gemini"] else config["sysfreq"]) app = DummyApp(n_chans, history=update_interval, tstep=t_step) # Register callbacks to update the app's state when appropriate packets are received. _ = cbsdk.register_spk_callback(nsp_obj, app.update_state)