ladisk / LDAQ

MIT License
24 stars 5 forks source link

No line graph on macOS #70

Closed JohannesMaierhofer closed 11 months ago

JohannesMaierhofer commented 11 months ago

Hi and thanks for this great tool. I'm working on macOS, python 3.11. Everything works quite smooth but I can't get a graph line in the visualization. I can measure and save the data as intended.

My minimal working example is:

import LDAQ

acq_serial = LDAQ.serial_communication.SerialAcquisitionSimple(port="/dev/cu.usbmodem1101", baudrate=115200,
                                                acquisition_name="arduino",
                                                delimiter=",",
                                                start_character= "",
                                                end_character  = "\r\n",
                                                sample_rate=None,
                                                channel_names=None)

vis = LDAQ.Visualization(refresh_rate=100, max_points_to_refresh=1e4, sequential_plot_updates=True)

vis.add_lines((0, 0), source="arduino", channels=0)
vis.add_lines((1, 0), source="arduino", channels=1)

vis.config_subplot((0, 0), xlim=None, ylim=(0, 5), axis_style='linear')
vis.config_subplot((1, 0), xlim=(0, 1), ylim=(0, 5), axis_style='linear')

ldaq = LDAQ.Core(acquisitions=[acq_serial],visualization=vis)

ldaq.run(measurement_duration=10)
TKosir commented 11 months ago

Thank you for trying out our package!

I've tried running your minimal script on macOS, but I've changed the code slightly to accommodate for my arduino (changed the y limits, port and baudrate). The code was the following:

import LDAQ
acq_serial = LDAQ.serial_communication.SerialAcquisitionSimple(port="/dev/tty.usbmodem142301", baudrate=9600, # changed this line
                                                acquisition_name="arduino",
                                                delimiter=",",
                                                start_character= "",
                                                end_character  = "\r\n",
                                                sample_rate=None,
                                                channel_names=None)

vis = LDAQ.Visualization(refresh_rate=100, max_points_to_refresh=1e4, sequential_plot_updates=True)

vis.add_lines((0, 0), source="arduino", channels=0)
vis.add_lines((1, 0), source="arduino", channels=1)

vis.config_subplot((0, 0), xlim=None, ylim=(0, 5000), axis_style='linear')   # changed the limits
vis.config_subplot((1, 0), xlim=(0, 1), ylim=(0, 5000), axis_style='linear') # changed the limits

ldaq = LDAQ.Core(acquisitions=[acq_serial],visualization=vis)

ldaq.run(measurement_duration=10)

print( ldaq.get_measurement_dict() )

The upper code worked for me, and I can see the lines of the channels. Do you get any errors or warnings while running the script? If so, a traceback would be appreciated!

JohannesMaierhofer commented 11 months ago

Thanks for reaching out. I tried with a super simple dummy microcontroller code. There, it works. Probably I have problems with formatting the output of my measurement data.

I get a terminal print: Unknown property align But I don't know if it affects the functionality.

Is it intended that the GUI closes right after finishing the measurement?

TKosir commented 11 months ago

The warning you get should not affect the functionality, we will fix the warning in future releases.

You can disable the auto closing of the GUI by specifying 'autoclose=False' in the ldaq.run() method.