Skip to content

Commit ca255bf

Browse files
authored
Merge pull request #31 from CerebusOSS/dev
Added b_gemini field to config.
2 parents d201ee4 + 8a77897 commit ca255bf

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

src/pycbsdk/cbhw/device/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(self, params: Params):
3030
), # Filled in upon receiving device config.
3131
"proc_chans": 0,
3232
"instrument": -1,
33+
"b_gemini": False,
3334
"channel_infos": {},
3435
"group_infos": {},
3536
"group_nchans": {},

src/pycbsdk/cbhw/device/nsp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ def _handle_procinfo(self, pkt):
488488
prot_str = f"{vmaj}.{vmin}"
489489
logger.info(f"Protocol version {prot_str}")
490490
self._config["proc_chans"] = pkt.chancount
491+
self._config["b_gemini"] = hasattr(pkt, "ident") and "gemini" in pkt.ident.lower()
491492
# config.protocol = prot_str # Too late; we already loaded our factory if we got this far.
492493

493494
def _handle_nplay(self, pkt):

src/pycbsdk/examples/group_sample_intervals.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,8 @@ def main(
8787
for ch in range(1, nchans + 1):
8888
_ = cbsdk.set_channel_config(nsp_obj, ch, "smpgroup", smpgroup)
8989

90-
# Calculate the clock step (I hate this)
91-
if inst_addr and int(inst_addr.split(".")[-1]) in [200, 201, 202, 203, 203]:
92-
# Note: This misses Gemini NSP!
93-
t_step = 1 / 1e9
94-
else:
95-
t_step = 1 / config["sysfreq"]
96-
9790
# Create a dummy app.
91+
t_step = 1 / (1e9 if config["b_gemini"] else config["sysfreq"])
9892
app = DummyApp(nchans, duration=duration, t_step=t_step)
9993

10094
time.sleep(2.0)

src/pycbsdk/examples/print_rates.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,8 @@ def main(
177177
]
178178
n_chans = sum(b_spk)
179179

180-
# Calculate the clock step (I hate this)
181-
if inst_addr and int(inst_addr.split(".")[-1]) in [200, 201, 202, 203, 203]:
182-
# Note: This misses Gemini NSP!
183-
t_step = 1 / 1e9
184-
else:
185-
t_step = 1 / config["sysfreq"]
186-
187180
# Create the dummy app.
181+
t_step = 1 / (1e9 if config["b_gemini"] else config["sysfreq"])
188182
app = DummyApp(n_chans, history=update_interval, tstep=t_step)
189183
# Register callbacks to update the app's state when appropriate packets are received.
190184
_ = cbsdk.register_spk_callback(nsp_obj, app.update_state)

0 commit comments

Comments
 (0)