Set Data location

Python

Set the save location for TIFF files measured by SmartScan. [dependency] - SmartRemote

main 1 file
Set Data location..py
set_data_location.py 1.1 KB
Set Data location..py 1124 bytes
from json import dumps
from SmartRemote import SmartRemote

class DataLocation:

    def __init__(self, SR:SmartRemote):
        self.__sr = SR
    
    def set_data_location(self, base_dir:str='C:\\SpmData', sub_dir:str='zeroscan' , file_name:str=''):
            """Set data Location

            Args:
                base_dir (_type_, optional): basedir path. Defaults to 'C:\SpmData'.
                file_name (str, optional): file name. Defaults to 'ZeroScan'.
            """
            loc = {'baseDir': base_dir,
                'subDir': f'{sub_dir}',
                'cameraSave': False,
                'direction': 'auto',
                'fileName' : file_name,
                'fileSuffix':' %1_%N_%G',
                'jpegSave': False,
                'precision':1,
                }
            json_loc = dumps(loc)
            reply = self.__sr.run(f'spm.dataLocation={json_loc}')
            return reply
    
if __name__ == "__main__":
    sr = SmartRemote()
    data_location = DataLocation(sr)
    data_location.set_data_location('C:\\SpmData','test_scan','my_scan')
Comments (0)

No comments yet. Be the first to comment!

Snippet Information
Author: jungyu.lee
Language: Python
Created: Oct 23, 2025
Updated: 0 minutes ago
Views: 35
Stars: 1

Links & Files

Additional Files (1):