SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie Building scientific experiments with F#

UG thesis presentation
UG thesis presentationUG thesis presentation
UG thesis presentationLuke 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 methodsAnubhav Jain
 
Power point presentation for science research
Power point presentation for science researchPower point presentation for science research
Power point presentation for science researchSatish 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 RegenerationSatish Bhat
 
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 unavoidableBob Eisenberg
 
Nanotechnology Progess And Pitfalls
Nanotechnology Progess And PitfallsNanotechnology Progess And Pitfalls
Nanotechnology Progess And Pitfallsphackettualberta
 
Cleo pr-invited
Cleo pr-invitedCleo pr-invited
Cleo pr-invitedKelvin 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 ALCFIan Foster
 
Neural Engineering Research Overview
Neural Engineering Research OverviewNeural Engineering Research Overview
Neural Engineering Research OverviewRyanClement
 
From physics to data science
From physics to data scienceFrom physics to data science
From physics to data scienceAndrew Lowe
 
University Case Study Bangladesh
University Case Study BangladeshUniversity Case Study Bangladesh
University Case Study Bangladeshomorfarukparveztopu
 
My resume_Nai-Chen Cheng
My resume_Nai-Chen ChengMy resume_Nai-Chen Cheng
My resume_Nai-Chen ChengNai-Chen Cheng
 
Running Hot October 2008
Running Hot October 2008Running Hot October 2008
Running Hot October 2008Ian Foster
 
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/15MLconf
 

Ähnlich wie 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
 

Kürzlich hochgeladen

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
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
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.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.pdfkalichargn70th171
 
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
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Kürzlich hochgeladen (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
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
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
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
 
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
 
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
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

Building scientific experiments with F#