Gatan | AMETEKSkip to Main Content
No options found

PMT time series for MonoCL3 and MonoCL4 systems

DigitalMicrograph Script

Generates an intensity profile as a function of time using the cps value displayed in the MonoCL Control palette. Useful for measuring beam-induced changes in the specimen emission intensity.

// Prototype routine for streaming counts off 


class PA3UISentry
{

	PA3UISentry(object self)
	{
		CLDisableUI();
	}

	~PA3UISentry(object self)
	{
		CLEnableUI(0);
	} 
  
}

class ProgressSentry
{
	ProgressSentry(object self)
	{
		
	}

	~ProgressSentry(object self)
	{
		OpenAndSetProgressWindow(" ", "", "")
	} 

	
	object Init(object self, string str1, string str2, string str3)
	{
		OpenAndSetProgressWindow(str1, str2, str3);
		return self; 
	}	
}
 
     
class CLSeriesAcquireThread //: thread     
{
	void RunThread(object self)
	{
		// Sample rate of PA3 is 3Hz?
		number dwellTime = 1/3 ;			
		

		// Ask tester to confirm the dwell time.
		if(0 == GetNumber("Sample time (s):", dwellTime, dwellTime))
			return;

		// Create sentries for progress and PA3 UI.
		object ui_sentry = alloc(  PA3UISentry);
		object progressSentry = alloc(ProgressSentry).Init("Acquire PA3 Series", " - hold space to abort", "")

		// Create and show line plot.
		Image series := RealImage("CL Time Acquire", 4, 1, 1);  
		ShowImage(series);
		
		
		// Could ask user for traget samples here.
		number targetSamples = infinity();
		
		number nSamples = 0;
		number start = GetTicks()/GetTicksPerSecond();
		while(!spacedown() && nSamples < targetSamples) 
		{
			nSamples++; 
			number val = CLAcquireSerial( dwellTime );
	
			if(nSamples > 1)
			{
				Image buffer = series.ImageClone();
				ImageResize(series, 1, nSamples);
				series[0, 0, 1, nSamples - 1] = buffer;
			}
			series.SetPixel(nSamples - 1, 0, val);	
			Series.UpdateImage();
			series.ImageGetImageDisplay(0).LinePlotImageDisplaySetDisplayedChannels(0, nSamples);
			number end = GetTicks()/GetTicksPerSecond();
			number scale = (end - start)/nSamples;
			series.ImageSetDimensionCalibration(0, 0, scale, "seconds", 0);
		}
		
		// Diagnostics.
		result("Actual time per sample: " + series.ImageGetDimensionScale(0) + "\n");
		
	}
}


alloc(CLSeriesAcquireThread).RunThread();