Hi,

From my understanding, using the artiq_run -o command I should be able to write my results in a HDF5 type file.
I am using this basic test code, which prints the voltages the terminal correctly in default.

from artiq.experiment import *
import numpy as np
import sys
import artiq.coredevice.ad9910 as ad9910
class DDSTest(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("sampler0")
@kernel
def run(self):
self.core.reset()
self.sampler0.set_gain_mu(0,0)
self.core.break_realtime()
smp=[0.0]*8
self.sampler0.sample(smp)
print("Voltages are", smp)

##Command used in terminal
I used this command in the terminal artiq_run -o test.hdf5 ADCsampler.py

##Reading the HDF5 file
I tried reading the file using

import h5py
import numpy as np
with h5py.File('test.hdf5', 'r') as f:
for key in f.keys():
print("{}:{}".format(key, f[key]))

I am getting an empty file,

Please format your forum posts correctly. Your code is hard to read.

You are not producing any dataset in your experiment, so it is expected that the HDF5 file is empty. Please read the ARTIQ manual where it explains how to create datasets.

from artiq.experiment import *
import numpy as np
import sys
import artiq.coredevice.ad9910 as ad9910

  class DDSTest(EnvExperiment):
    def build(self):
          self.setattr_device("core")
          self.setattr_device("sampler0")
    @kernel
     def run(self):
         self.core.reset()
         self.sampler0.set_gain_mu(0,0)
         self.core.break_realtime()
         smp=[0.0]*8
         self.sampler0.sample(smp)
         print("Voltages are", smp)

Thank you, I understand what I need to add to create a dataset now . I was missing the set_dataset()