SlideShare a Scribd company logo
Building scientific
experiments with F#
A. Tcholakov, B. L. Green, A. C. Frangeskou, C. J. Stephen, P. Diggle,
J. Lishman, T. Wheeler, M. E. Newton, and G. W. Morley
A. Tcholakov, B. L. Green, A. C. Frangeskou, C. J. Stephen, P. Diggle,
J. Lishman, T. Wheeler, M. E. Newton, and G. W. Morley
Building scientific
experiments with F#
A. Tcholakov, B. L. Green, A. C. Frangeskou, C. J. Stephen, P. Diggle,
J. Lishman, T. Wheeler, M. E. Newton, and G. W. Morley
Building scientific
experiments with F#
A. Tcholakov, B. L. Green, A. C. Frangeskou, C. J. Stephen, P. Diggle,
J. Lishman, T. Wheeler, M. E. Newton, and G. W. Morley
Building scientific
experiments with F#
A. Tcholakov, B. L. Green, A. C. Frangeskou, C. J. Stephen, P. Diggle,
J. Lishman, T. Wheeler, M. E. Newton, and G. W. Morley
Building scientific
experiments with F#
Anatomy of an experiment
PC
Output
device
Input
device
Science!
@ant_pt
• Concurrent control of multiple devices
• Cancellation
• Reporting of partial progress
• Signal processing
• Robust error handling
• Good performance
Requirements
@ant_pt
• Concurrent control of multiple devices
• Cancellation
• Reporting of partial progress
• Signal processing
• Robust error handling
• Good performance
Requirements… and solutions
Async<'T>
IObservable<'T>
Choice<'T1,'T2> or exn?
}
}
@ant_pt
• Software isn’t actually the key output
• Experiments start as prototypes
• Need path to fully-fledged application
Requirements (process)
@ant_pt
• National Instruments VISA
• C API + DLL import
• Typically very imperative and stateful
• Inherently Async, MailboxProcessor-like
Instrument I/O
@ant_pt
Command-request agent
• Module for creating MailboxProcessor agents
which process Command or Request messages
• Instrument APIs often have large surface area
• Propagates errors to caller without stopping the
agent
@ant_pt
Code…
Command-request agent
@ant_pt
Oscilloscope
• Essential tool in a
physics lab
• Records voltages
against time
• Has settings for
triggering, input
range, offset, etc.
Source: “Oscilloscope.” Wikipedia: The Free Encyclopaedia.
Wikimedia Foundation, Inc. 20 Mar 2016. Web. 13 Apr 2016.
@ant_pt
Code…
PicoScope agent
@ant_pt
PicoScope agent: review
• Async but still imperative
• Device is typically used in one of several modes:
streaming, block acquisition, etc.
• Functional approach:
- model acquisition configuration
- define workflow to run a general acquisition
- push sample blocks via IObservable<'T>
@ant_pt
Code…
PicoScope streaming
@ant_pt
@ant_pt
laser
to optical fibre
@ant_pt
laser
to optical fibre
sample
@ant_pt
laser
to optical fibre
sample
todetector
@ant_pt
laser
to optical fibre
sample
todetector
microwave oscillator
@ant_pt
laser
to optical fibre
sample
todetector
microwave oscillator
toantenna
@ant_pt
laser
to optical fibre
sample
todetector
microwave oscillator
toantenna
frequency tuning
@ant_pt
laser
to optical fibre
sample
todetector
microwave oscillator
toantenna
frequency tuning
magnet
@ant_pt
Code…
N-V-
spectrometer
@ant_pt
N-V-
spectrometer: review
• Declarative streaming API makes code
straightforward to read, write, and modify
• IObservable<'T> + FSharp.Control.Reactive
offer a powerful way to implement DSP
• FSharp.Charting is great for prototyping
• Async provides robust cancellation support
• MailboxProcessor ensures sequential I/O
@ant_pt
397 GHz spectrometer
@ant_pt
397 GHz spectrometer
• Irradiate sample with
397 GHz mm-waves
• Sweep field on
superconducting
magnet system
• Measure what comes
back and stream
data with PicoScope
@ant_pt
397 GHz spectrometer
@ant_pt
Confocal microscope
@ant_pt
Confocal microscope
• 3-axis piezoelectric
scanning stage for
imaging
• Photon counting
detection
• Single molecule
sensitivity (for
fluorescent samples)
@ant_pt
Confocal microscope
Pulse length
(1ns resolution)
Integrated
photon counts
Acquisition
parameters
System development time: ~9 months
Oscillations represent
manipulation of a qubit!
@ant_pt
Performance
• Hasn’t really been a problem
• PicoScope streaming acquisition copes with 32ns
sample interval (fastest available) in .fsx
• Time tagging acquisition copes with several
million photon counts per second
@ant_pt
Towards open source…
• Aim to publish the code under Apache 2.0
• Wrappers for several common lab instruments
• First need to:
- migrate to Paket, FAKE
- make namespaces consistent
- consolidate git branches
- write some unit tests (?)
@ant_pt
Conclusions
• F# is a great fit for instrument control thanks to
powerful Async, Reactive programming features
• Functional paradigm + .fsx aids prototyping
• Units of measure are the cherry on top
• Working towards open source instrument
libraries
@ant_pt

More Related Content

Similar to Building scientific experiments with F#

UG thesis presentation
UG thesis presentationUG thesis presentation
UG thesis presentation
Luke Zhao
 
Computational materials design with high-throughput and machine learning methods
Computational materials design with high-throughput and machine learning methodsComputational materials design with high-throughput and machine learning methods
Computational materials design with high-throughput and machine learning methods
Anubhav Jain
 
Power point presentation for science research
Power point presentation for science researchPower point presentation for science research
Power point presentation for science research
Satish Bhat
 
PEA技術 国際学会発表資料
PEA技術 国際学会発表資料PEA技術 国際学会発表資料
PEA技術 国際学会発表資料
FINE PIECE
 
Using Polycaprolactone for Tissue Regeneration
Using Polycaprolactone for Tissue RegenerationUsing Polycaprolactone for Tissue Regeneration
Using Polycaprolactone for Tissue Regeneration
Satish Bhat
 
Barth, B. B. CV
Barth, B. B. CVBarth, B. B. CV
Barth, B. B. CV
Bradley Barth
 
Talk multiscale analysis of ionic solutions is unavoidable
  Talk multiscale analysis of ionic solutions is unavoidable  Talk multiscale analysis of ionic solutions is unavoidable
Talk multiscale analysis of ionic solutions is unavoidable
Bob Eisenberg
 
Nanotechnology Progess And Pitfalls
Nanotechnology Progess And PitfallsNanotechnology Progess And Pitfalls
Nanotechnology Progess And Pitfalls
phackettualberta
 
Cleo pr-invited
Cleo pr-invitedCleo pr-invited
Cleo pr-invited
Kelvin Ooi
 
Going Smart and Deep on Materials at ALCF
Going Smart and Deep on Materials at ALCFGoing Smart and Deep on Materials at ALCF
Going Smart and Deep on Materials at ALCF
Ian Foster
 
Cern general information
Cern general informationCern general information
Neural Engineering Research Overview
Neural Engineering Research OverviewNeural Engineering Research Overview
Neural Engineering Research Overview
RyanClement
 
From physics to data science
From physics to data scienceFrom physics to data science
From physics to data science
Andrew Lowe
 
University Case Study Bangladesh
University Case Study BangladeshUniversity Case Study Bangladesh
University Case Study Bangladesh
omorfarukparveztopu
 
bio tenten.pptx
bio tenten.pptxbio tenten.pptx
bio tenten.pptx
BharathYusha1
 
My resume_Nai-Chen Cheng
My resume_Nai-Chen ChengMy resume_Nai-Chen Cheng
My resume_Nai-Chen Cheng
Nai-Chen Cheng
 
Science and Technology
Science and TechnologyScience and Technology
Science and Technology
DivyanshuTyagi8
 
Running Hot October 2008
Running Hot October 2008Running Hot October 2008
Running Hot October 2008
Ian Foster
 
CV
CVCV
Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15
Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15
Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15
MLconf
 

Similar to Building scientific experiments with F# (20)

UG thesis presentation
UG thesis presentationUG thesis presentation
UG thesis presentation
 
Computational materials design with high-throughput and machine learning methods
Computational materials design with high-throughput and machine learning methodsComputational materials design with high-throughput and machine learning methods
Computational materials design with high-throughput and machine learning methods
 
Power point presentation for science research
Power point presentation for science researchPower point presentation for science research
Power point presentation for science research
 
PEA技術 国際学会発表資料
PEA技術 国際学会発表資料PEA技術 国際学会発表資料
PEA技術 国際学会発表資料
 
Using Polycaprolactone for Tissue Regeneration
Using Polycaprolactone for Tissue RegenerationUsing Polycaprolactone for Tissue Regeneration
Using Polycaprolactone for Tissue Regeneration
 
Barth, B. B. CV
Barth, B. B. CVBarth, B. B. CV
Barth, B. B. CV
 
Talk multiscale analysis of ionic solutions is unavoidable
  Talk multiscale analysis of ionic solutions is unavoidable  Talk multiscale analysis of ionic solutions is unavoidable
Talk multiscale analysis of ionic solutions is unavoidable
 
Nanotechnology Progess And Pitfalls
Nanotechnology Progess And PitfallsNanotechnology Progess And Pitfalls
Nanotechnology Progess And Pitfalls
 
Cleo pr-invited
Cleo pr-invitedCleo pr-invited
Cleo pr-invited
 
Going Smart and Deep on Materials at ALCF
Going Smart and Deep on Materials at ALCFGoing Smart and Deep on Materials at ALCF
Going Smart and Deep on Materials at ALCF
 
Cern general information
Cern general informationCern general information
Cern general information
 
Neural Engineering Research Overview
Neural Engineering Research OverviewNeural Engineering Research Overview
Neural Engineering Research Overview
 
From physics to data science
From physics to data scienceFrom physics to data science
From physics to data science
 
University Case Study Bangladesh
University Case Study BangladeshUniversity Case Study Bangladesh
University Case Study Bangladesh
 
bio tenten.pptx
bio tenten.pptxbio tenten.pptx
bio tenten.pptx
 
My resume_Nai-Chen Cheng
My resume_Nai-Chen ChengMy resume_Nai-Chen Cheng
My resume_Nai-Chen Cheng
 
Science and Technology
Science and TechnologyScience and Technology
Science and Technology
 
Running Hot October 2008
Running Hot October 2008Running Hot October 2008
Running Hot October 2008
 
CV
CVCV
CV
 
Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15
Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15
Ce Zhang, Postdoctoral Researcher, Stanford University at MLconf ATL - 9/18/15
 

Recently uploaded

ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 

Recently uploaded (20)

ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 

Building scientific experiments with F#