Created
June 17, 2024 12:19
-
-
Save bodokaiser/c556b28e4d4e9489d6b8ff7966b8ba6d to your computer and use it in GitHub Desktop.
Generates the RF spectrum to create a tweezer array using AODs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spcm | |
from spcm import units | |
import numpy as np | |
config = { | |
# 18925: { | |
# "path": "/dev/spcm0", | |
# "freq": np.linspace(84.5, 120.5, 3), | |
# "freq": [(120.5+84.5)/2] | |
# }, | |
18924: { | |
"path": "/dev/spcm1", | |
#"freq": np.linspace(85.0, 121.0, 3), | |
"freq": [(121+85)/2] | |
#"freq": [84.5] | |
#"freq": [120.5] | |
}, | |
} | |
with spcm.CardStack( | |
card_identifiers=[config["path"] for config in config.values()] | |
) as stack: | |
channels = spcm.Channels(stack=stack, card_enable=spcm.CHANNEL0) | |
channels.enable(True) | |
channels.amp(2. * units.V) | |
for card in stack.cards: | |
card.card_mode(spcm.SPC_REP_STD_DDS) | |
dds = spcm.DDS(card, channels=channels) | |
dds.reset() | |
conf = config[card.sn()] | |
for i, freq in enumerate(conf["freq"]): | |
frac = 40 / len(conf["freq"]) | |
dds[i].amp(frac * units.percent) | |
#dds[i].amp(100 * units.percent) | |
dds[i].freq(freq * units.MHz) | |
print(f"set core {i} to {freq} MHz and {frac} % amplitude") | |
dds.exec_at_trg() | |
dds.write_to_card() | |
stack.start(spcm.M2CMD_CARD_ENABLETRIGGER, spcm.M2CMD_CARD_FORCETRIGGER) | |
input("press enter to exit") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment