SlideShare a Scribd company logo
1 of 11
Download to read offline
SCIENTIFIC INSTRUMENT
CONTROL WITH F#
Anton Tcholakov, Colin Stephen, Gavin Morley
Department of Physics, University of Warwick
@ant_pt
CUSTOM SPECTROMETER
CUSTOM SPECTROMETER
• Apply microwaves to a
sample in a magnetic field
• Measure the reflected
power
• Vary the magnetic field
• Changes in the signal help
to characterise the sample
REQUIREMENTS
REQUIREMENTS
• Concurrent control of multiple
instruments
• Real-time chart plotting
• Ability to save data and
experimental parameters
• Modularity
• Robust error handling
14.125 14.130 14.135 14.140
-6000
-4000
-2000
0
2000
4000
6000
8000
10000
EPRsignal(arb.units)
Magnetic field (T)
DOMAIN MODELLING
• Records, unions and units of measure let us model hardware
capabilities and experiment parameters clearly and concisely
• We get structural equality and serialisation for free
type Frequency = FrequencyInHz of float<Hz>
type Amplitude = PowerInDbm of float<dBm>
type StepSpacing = LinearSpacing | LogarithmicSpacing
type Range<'T> = { Start : ’T ; Stop : 'T }
type FrequencySweep =
| FrequencySweep of range : Range<Frequency>
| FixedFrequency of frequency : Frequency
type AmplitudeSweep =
| AmplitudeSweep of range : Range<Amplitude>
| FixedAmplitude of amplitude : Amplitude
type StepSweep =
{ Frequency : FrequencySweep
Amplitude : AmplitudeSweep
NumberOfPoints : int
Spacing : StepSpacing }
INSTRUMENT CONTROL
• Communication to hardware is inherently async
• async workflows are great metaphor for
experiments
• Use asyncChoice (available in ExtCore) and
railway-oriented programming to handle errors
DATA ACQUISITION
type StreamingAcquisition =
{ Parameters : StreamingParameters
Buffers : AcquisitionBuffers
StopCapability : CancellationCapability<StreamStopOptions>
StatusChanged : Event<StreamStatus>
SampleBlockObserved : Event<SampleBlock> }
let run scope acquisition = asyncChoice {
use acquisitionHandle =
PicoScope.Acquisition.allocateHandle digitiser acquisition.Buffers
do! prepare scope acquisition
do! startStreaming scope acquisition
do! pollUntilStopped scope acquisition }
• Acquisition emits samples via Event<‘T>, so we can feed this straight
into FSharp.Charting
• Use Rx transformations to implement signal processing
WHAT DO OTHERS USE?
C / C++
• Low level, manual memory and thread management
Python
• Global Interpreter Lock can cause problems
• Pay the price for dynamic typing in large projects
C# (… in industry?)
LabVIEW
• Looks and feels like it belongs in the 90s
• … but has a vast library of instrument drivers
SUMMARY
• F#’s type system allows us to model our problem
domain clearly and concisely
• Many of the tools we need are already available
(async, Rx, FSharp.Charting)
• F# is very well suited to the task but lacks
instrument libraries and user base

More Related Content

What's hot

Svd filtered temporal usage clustering
Svd filtered temporal usage clusteringSvd filtered temporal usage clustering
Svd filtered temporal usage clusteringLiang Xie, PhD
 
C-SAW: A Framework for Graph Sampling and Random Walk on GPUs
C-SAW: A Framework for Graph Sampling and Random Walk on GPUsC-SAW: A Framework for Graph Sampling and Random Walk on GPUs
C-SAW: A Framework for Graph Sampling and Random Walk on GPUsPandey_G
 
Super COMPUTING Journal
Super COMPUTING JournalSuper COMPUTING Journal
Super COMPUTING JournalPandey_G
 
Exploring Raster with FME
Exploring Raster with FMEExploring Raster with FME
Exploring Raster with FMESafe Software
 
Point Clouds: What's New
Point Clouds: What's NewPoint Clouds: What's New
Point Clouds: What's NewSafe Software
 
Adaptive Compilation by Jecel Mattos de Assumpção Jr
Adaptive Compilation by Jecel Mattos de Assumpção JrAdaptive Compilation by Jecel Mattos de Assumpção Jr
Adaptive Compilation by Jecel Mattos de Assumpção JrFAST
 
Building blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applicationsBuilding blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applicationsFoCAS Initiative
 
Analisa Expression pada after effect menggungakan bahasa script
Analisa  Expression pada after effect menggungakan bahasa scriptAnalisa  Expression pada after effect menggungakan bahasa script
Analisa Expression pada after effect menggungakan bahasa scriptVamelAfganisme Quartz
 
Arbitary Waveform Generator By Nisarg Vasavada.
Arbitary Waveform Generator By Nisarg Vasavada.Arbitary Waveform Generator By Nisarg Vasavada.
Arbitary Waveform Generator By Nisarg Vasavada.Nisarg Vasavada
 
Traffic state estimation with multi-sensor data for large networks with macro...
Traffic state estimation with multi-sensor data for large networks with macro...Traffic state estimation with multi-sensor data for large networks with macro...
Traffic state estimation with multi-sensor data for large networks with macro...YazanSafadi
 
Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...
Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...
Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...YazanSafadi
 
Experiments & Experiences with Scilab in Undergraduate Education
Experiments & Experiences with Scilab in Undergraduate Education Experiments & Experiences with Scilab in Undergraduate Education
Experiments & Experiences with Scilab in Undergraduate Education Naren P.R.
 
Guided Wave Propagation Simulation by ANSYS
Guided Wave Propagation Simulation by ANSYS Guided Wave Propagation Simulation by ANSYS
Guided Wave Propagation Simulation by ANSYS Ping Hung Lee
 
Process Simulation using DWSIM
Process Simulation using DWSIMProcess Simulation using DWSIM
Process Simulation using DWSIMNaren P.R.
 
Vtk Image procesing
Vtk Image procesingVtk Image procesing
Vtk Image procesingSonu Mangal
 

What's hot (20)

Svd filtered temporal usage clustering
Svd filtered temporal usage clusteringSvd filtered temporal usage clustering
Svd filtered temporal usage clustering
 
C-SAW: A Framework for Graph Sampling and Random Walk on GPUs
C-SAW: A Framework for Graph Sampling and Random Walk on GPUsC-SAW: A Framework for Graph Sampling and Random Walk on GPUs
C-SAW: A Framework for Graph Sampling and Random Walk on GPUs
 
Super COMPUTING Journal
Super COMPUTING JournalSuper COMPUTING Journal
Super COMPUTING Journal
 
Comp
CompComp
Comp
 
Johnson Trotter Algorithm(Permutation)
Johnson Trotter Algorithm(Permutation)Johnson Trotter Algorithm(Permutation)
Johnson Trotter Algorithm(Permutation)
 
Ds36715716
Ds36715716Ds36715716
Ds36715716
 
Exploring Raster with FME
Exploring Raster with FMEExploring Raster with FME
Exploring Raster with FME
 
Point Clouds: What's New
Point Clouds: What's NewPoint Clouds: What's New
Point Clouds: What's New
 
Adaptive Compilation by Jecel Mattos de Assumpção Jr
Adaptive Compilation by Jecel Mattos de Assumpção JrAdaptive Compilation by Jecel Mattos de Assumpção Jr
Adaptive Compilation by Jecel Mattos de Assumpção Jr
 
Building blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applicationsBuilding blocks for aggregate programming of self-organising applications
Building blocks for aggregate programming of self-organising applications
 
Analisa Expression pada after effect menggungakan bahasa script
Analisa  Expression pada after effect menggungakan bahasa scriptAnalisa  Expression pada after effect menggungakan bahasa script
Analisa Expression pada after effect menggungakan bahasa script
 
Arbitary Waveform Generator By Nisarg Vasavada.
Arbitary Waveform Generator By Nisarg Vasavada.Arbitary Waveform Generator By Nisarg Vasavada.
Arbitary Waveform Generator By Nisarg Vasavada.
 
Traffic state estimation with multi-sensor data for large networks with macro...
Traffic state estimation with multi-sensor data for large networks with macro...Traffic state estimation with multi-sensor data for large networks with macro...
Traffic state estimation with multi-sensor data for large networks with macro...
 
Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...
Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...
Macroscopic Fundamental Diagram using Traffic Simulation and Control (AIMSUN ...
 
Experiments & Experiences with Scilab in Undergraduate Education
Experiments & Experiences with Scilab in Undergraduate Education Experiments & Experiences with Scilab in Undergraduate Education
Experiments & Experiences with Scilab in Undergraduate Education
 
Scilab
ScilabScilab
Scilab
 
Guided Wave Propagation Simulation by ANSYS
Guided Wave Propagation Simulation by ANSYS Guided Wave Propagation Simulation by ANSYS
Guided Wave Propagation Simulation by ANSYS
 
Process Simulation using DWSIM
Process Simulation using DWSIMProcess Simulation using DWSIM
Process Simulation using DWSIM
 
Vtk Image procesing
Vtk Image procesingVtk Image procesing
Vtk Image procesing
 
R intro
R introR intro
R intro
 

Viewers also liked

Instrument & Control Courses
Instrument & Control Courses Instrument & Control Courses
Instrument & Control Courses mfkhroosa
 
Instrument & Control Introduction
Instrument & Control IntroductionInstrument & Control Introduction
Instrument & Control IntroductionMorteza Shahmoradi
 
Sequel System Instrument Control Software
Sequel System Instrument Control SoftwareSequel System Instrument Control Software
Sequel System Instrument Control SoftwareOctavio Luna
 
Sept2016 sv pac_bio_visualization
Sept2016 sv pac_bio_visualizationSept2016 sv pac_bio_visualization
Sept2016 sv pac_bio_visualizationGenomeInABottle
 
Building scientific experiments with F#
Building scientific experiments with F#Building scientific experiments with F#
Building scientific experiments with F#ant_pt
 
How to NLProc from .NET
How to NLProc from .NETHow to NLProc from .NET
How to NLProc from .NETSergey Tihon
 
Process of instrument making
Process of instrument makingProcess of instrument making
Process of instrument makingPengeneee Peng
 
23 richard a. hall - 5287265 - interfacing methods for use in inputting ope...
23   richard a. hall - 5287265 - interfacing methods for use in inputting ope...23   richard a. hall - 5287265 - interfacing methods for use in inputting ope...
23 richard a. hall - 5287265 - interfacing methods for use in inputting ope...Mello_Patent_Registry
 
Career Guidance in Instrumentation-2013 edition
Career Guidance in Instrumentation-2013 editionCareer Guidance in Instrumentation-2013 edition
Career Guidance in Instrumentation-2013 editionMohamed Uwaise, CAP®
 
An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...
An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...
An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...Altair
 
Introduction to fundamentals of instrument & control
Introduction to fundamentals of instrument & controlIntroduction to fundamentals of instrument & control
Introduction to fundamentals of instrument & controlMahmoud Wanis
 
ipec.info | Pfd p&id
ipec.info | Pfd p&idipec.info | Pfd p&id
ipec.info | Pfd p&idIPEC
 
Fundamentals of FPGA
Fundamentals of FPGAFundamentals of FPGA
Fundamentals of FPGAvelamakuri
 

Viewers also liked (14)

Instrument & Control Courses
Instrument & Control Courses Instrument & Control Courses
Instrument & Control Courses
 
Instrument & Control Introduction
Instrument & Control IntroductionInstrument & Control Introduction
Instrument & Control Introduction
 
Sequel System Instrument Control Software
Sequel System Instrument Control SoftwareSequel System Instrument Control Software
Sequel System Instrument Control Software
 
Sept2016 sv pac_bio_visualization
Sept2016 sv pac_bio_visualizationSept2016 sv pac_bio_visualization
Sept2016 sv pac_bio_visualization
 
Building scientific experiments with F#
Building scientific experiments with F#Building scientific experiments with F#
Building scientific experiments with F#
 
How to NLProc from .NET
How to NLProc from .NETHow to NLProc from .NET
How to NLProc from .NET
 
Process of instrument making
Process of instrument makingProcess of instrument making
Process of instrument making
 
23 richard a. hall - 5287265 - interfacing methods for use in inputting ope...
23   richard a. hall - 5287265 - interfacing methods for use in inputting ope...23   richard a. hall - 5287265 - interfacing methods for use in inputting ope...
23 richard a. hall - 5287265 - interfacing methods for use in inputting ope...
 
Career Guidance in Instrumentation-2013 edition
Career Guidance in Instrumentation-2013 editionCareer Guidance in Instrumentation-2013 edition
Career Guidance in Instrumentation-2013 edition
 
An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...
An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...
An Automated Head Impact Process Setup for Automobile Instrument Panel (IP) A...
 
Introduction to fundamentals of instrument & control
Introduction to fundamentals of instrument & controlIntroduction to fundamentals of instrument & control
Introduction to fundamentals of instrument & control
 
ipec.info | Pfd p&id
ipec.info | Pfd p&idipec.info | Pfd p&id
ipec.info | Pfd p&id
 
Basic instrumentation
Basic instrumentationBasic instrumentation
Basic instrumentation
 
Fundamentals of FPGA
Fundamentals of FPGAFundamentals of FPGA
Fundamentals of FPGA
 

Similar to Scientific instrument control with F#

Strength of Materials iLab
Strength of Materials iLabStrength of Materials iLab
Strength of Materials iLabBabatunde Ishola
 
SERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolSERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolHenry Muccini
 
SERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENEWorkshop
 
Digial instrumentation fnal
Digial instrumentation fnalDigial instrumentation fnal
Digial instrumentation fnalBishal Rimal
 
Katalog produk chauvin arnoux power quality analyser ca8336 by tridinamika
Katalog produk chauvin arnoux power quality analyser ca8336 by tridinamikaKatalog produk chauvin arnoux power quality analyser ca8336 by tridinamika
Katalog produk chauvin arnoux power quality analyser ca8336 by tridinamikaPT. Tridinamika Jaya Instrument
 
Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...
Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...
Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Random access scan
Random access scan Random access scan
Random access scan Harish Peta
 
Advancements in the Real-Time Simulation of Large Active Distribution Systems...
Advancements in the Real-Time Simulation of Large Active Distribution Systems...Advancements in the Real-Time Simulation of Large Active Distribution Systems...
Advancements in the Real-Time Simulation of Large Active Distribution Systems...OPAL-RT TECHNOLOGIES
 
Crash course on data streaming (with examples using Apache Flink)
Crash course on data streaming (with examples using Apache Flink)Crash course on data streaming (with examples using Apache Flink)
Crash course on data streaming (with examples using Apache Flink)Vincenzo Gulisano
 
Tektronix and keithley product and apps update q3 2016
Tektronix and keithley product and apps update q3 2016Tektronix and keithley product and apps update q3 2016
Tektronix and keithley product and apps update q3 2016Jeff Sable
 
Spectral Analysis of Sample Rate Converter
Spectral Analysis of Sample Rate ConverterSpectral Analysis of Sample Rate Converter
Spectral Analysis of Sample Rate ConverterCSCJournals
 
OPAL-RT RT14 Conference: egston compiso opal-rt
OPAL-RT RT14 Conference:  egston compiso opal-rtOPAL-RT RT14 Conference:  egston compiso opal-rt
OPAL-RT RT14 Conference: egston compiso opal-rtOPAL-RT TECHNOLOGIES
 
Accurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed ClocksAccurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed ClocksDesign World
 
Resume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed SignalResume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed SignalArizona State University
 
Resume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed SignalResume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed SignalArizona State University
 
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...waqarnabi
 
Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...
Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...
Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...TSC University of Mondragon
 

Similar to Scientific instrument control with F# (20)

Strength of Materials iLab
Strength of Materials iLabStrength of Materials iLab
Strength of Materials iLab
 
Strel streaming
Strel streamingStrel streaming
Strel streaming
 
OPAL-RT ePHASORsim Webinar
OPAL-RT ePHASORsim WebinarOPAL-RT ePHASORsim Webinar
OPAL-RT ePHASORsim Webinar
 
SERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolSERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_school
 
SERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the Cloud
 
Digial instrumentation fnal
Digial instrumentation fnalDigial instrumentation fnal
Digial instrumentation fnal
 
Katalog produk chauvin arnoux power quality analyser ca8336 by tridinamika
Katalog produk chauvin arnoux power quality analyser ca8336 by tridinamikaKatalog produk chauvin arnoux power quality analyser ca8336 by tridinamika
Katalog produk chauvin arnoux power quality analyser ca8336 by tridinamika
 
Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...
Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...
Using MpCCI to model Fluid-Structure-Interactions with ABAQUS and 3rd party C...
 
Gene's law
Gene's lawGene's law
Gene's law
 
Random access scan
Random access scan Random access scan
Random access scan
 
Advancements in the Real-Time Simulation of Large Active Distribution Systems...
Advancements in the Real-Time Simulation of Large Active Distribution Systems...Advancements in the Real-Time Simulation of Large Active Distribution Systems...
Advancements in the Real-Time Simulation of Large Active Distribution Systems...
 
Crash course on data streaming (with examples using Apache Flink)
Crash course on data streaming (with examples using Apache Flink)Crash course on data streaming (with examples using Apache Flink)
Crash course on data streaming (with examples using Apache Flink)
 
Tektronix and keithley product and apps update q3 2016
Tektronix and keithley product and apps update q3 2016Tektronix and keithley product and apps update q3 2016
Tektronix and keithley product and apps update q3 2016
 
Spectral Analysis of Sample Rate Converter
Spectral Analysis of Sample Rate ConverterSpectral Analysis of Sample Rate Converter
Spectral Analysis of Sample Rate Converter
 
OPAL-RT RT14 Conference: egston compiso opal-rt
OPAL-RT RT14 Conference:  egston compiso opal-rtOPAL-RT RT14 Conference:  egston compiso opal-rt
OPAL-RT RT14 Conference: egston compiso opal-rt
 
Accurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed ClocksAccurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed Clocks
 
Resume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed SignalResume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed Signal
 
Resume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed SignalResume_Karthik_Koneru_Analog_and_Mixed Signal
Resume_Karthik_Koneru_Analog_and_Mixed Signal
 
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
A High-Level Programming Approach for using FPGAs in HPC using Functional Des...
 
Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...
Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...
Real-time Implementation of Sphere Decoder-based MIMO Wireless System (EUSIPC...
 

Recently uploaded

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Recently uploaded (20)

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

Scientific instrument control with F#

  • 1. SCIENTIFIC INSTRUMENT CONTROL WITH F# Anton Tcholakov, Colin Stephen, Gavin Morley Department of Physics, University of Warwick @ant_pt
  • 3. CUSTOM SPECTROMETER • Apply microwaves to a sample in a magnetic field • Measure the reflected power • Vary the magnetic field • Changes in the signal help to characterise the sample
  • 5. REQUIREMENTS • Concurrent control of multiple instruments • Real-time chart plotting • Ability to save data and experimental parameters • Modularity • Robust error handling 14.125 14.130 14.135 14.140 -6000 -4000 -2000 0 2000 4000 6000 8000 10000 EPRsignal(arb.units) Magnetic field (T)
  • 6. DOMAIN MODELLING • Records, unions and units of measure let us model hardware capabilities and experiment parameters clearly and concisely • We get structural equality and serialisation for free type Frequency = FrequencyInHz of float<Hz> type Amplitude = PowerInDbm of float<dBm> type StepSpacing = LinearSpacing | LogarithmicSpacing type Range<'T> = { Start : ’T ; Stop : 'T } type FrequencySweep = | FrequencySweep of range : Range<Frequency> | FixedFrequency of frequency : Frequency type AmplitudeSweep = | AmplitudeSweep of range : Range<Amplitude> | FixedAmplitude of amplitude : Amplitude type StepSweep = { Frequency : FrequencySweep Amplitude : AmplitudeSweep NumberOfPoints : int Spacing : StepSpacing }
  • 7. INSTRUMENT CONTROL • Communication to hardware is inherently async • async workflows are great metaphor for experiments • Use asyncChoice (available in ExtCore) and railway-oriented programming to handle errors
  • 8. DATA ACQUISITION type StreamingAcquisition = { Parameters : StreamingParameters Buffers : AcquisitionBuffers StopCapability : CancellationCapability<StreamStopOptions> StatusChanged : Event<StreamStatus> SampleBlockObserved : Event<SampleBlock> } let run scope acquisition = asyncChoice { use acquisitionHandle = PicoScope.Acquisition.allocateHandle digitiser acquisition.Buffers do! prepare scope acquisition do! startStreaming scope acquisition do! pollUntilStopped scope acquisition } • Acquisition emits samples via Event<‘T>, so we can feed this straight into FSharp.Charting • Use Rx transformations to implement signal processing
  • 9. WHAT DO OTHERS USE? C / C++ • Low level, manual memory and thread management Python • Global Interpreter Lock can cause problems • Pay the price for dynamic typing in large projects C# (… in industry?)
  • 10. LabVIEW • Looks and feels like it belongs in the 90s • … but has a vast library of instrument drivers
  • 11. SUMMARY • F#’s type system allows us to model our problem domain clearly and concisely • Many of the tools we need are already available (async, Rx, FSharp.Charting) • F# is very well suited to the task but lacks instrument libraries and user base