Gatan | AMETEKSkip to Main Content
No options found

DigiScan acquisition

Python Script

Example script starting a simple DigiScan acquisition via a parameter set. For more details on DigiScan access via scripting also refer to the DM-scripting documentation.

Preview

'''
Example script staring a simple DigiScan acquisition via a parameter set. 
Fore more details on DigiScan access via scripting also refer to the 
DM-scripting documentation.
'''
import DigitalMicrograph as DM
import numpy as np

# Create Acquistion Parameter set
rotation = 0
size = 512
pixelTime = 10
lineSync = False 
paramID = DM.DS_CreateParameters( size, size, rotation, pixelTime, lineSync )

# Add to be acquired signals
# Variant 1: Let DM create the destination image
signalIndex = 0	# 1st assigned STEM Detector. Usually HAADF
selectSignal = True
dataByte = 4	
useImgID = 0	

DM.DS_SetParametersSignal( paramID, signalIndex, dataByte, selectSignal, useImgID  )

# Variant 2: Provide a suitable data container (size and type must match)
signalIndex = 1	# 2nd assigned STEM Detector
selectSignal = True
dataByte = 4	
array = np.zeros(shape=(size,size),dtype='uint32')
dmImg = DM.CreateImage( array )
dmImg.ShowImage()
useImgID = dmImg.GetID()	
dmImg.SetName( "Provided image" )
del dmImg # Always delete image variables again when no longer needed

DM.DS_SetParametersSignal( paramID, signalIndex, dataByte, selectSignal, useImgID  )

# Run acquistion, temporarily disable UI
continuous = False
synchronous = True

DM.DS_DialogEnabled( False )
DM.DS_StartAcquisition_2( paramID, continuous, synchronous )
DM.DS_DialogEnabled( True )

# Remove Parameter set from memory again
DM.DS_DeleteParameters( paramID )