SlideShare une entreprise Scribd logo
1  sur  17
Python forScientists Dewes Quantronics Group Seminar
Python: Qu'est-ce que c'est? Multi-paradigm (objectoriented, functional…) print“Easy as…“ fori in [1,2,3]: printi ctypes,sockets,files,regex,… Matplotlib,SciPy,NumPy,PyQT,…
Whytouseit: A Scientific Workflow
Software makeslifeeasier…
Using Python…
Data Acquisition   http://pyvisa.sourceforge.net                                  http://docs.python.org/library/ctypes.html
PyVisaExample: MWG & VNA fromvisaimport* #Open a connectionto an Anritsu MWG anritsu = instrument(“GPIB0::12“) #Askfortheoutputfrequency print anritsu.ask(“OF1“) #Set theoutput power anritsu.write(“L15DM“) #Turn on themicrowave anritsu.write(“RF0“) vna = instrument(„GPIB0::15“) x = vna.ask_for_values(“fma;ofv;“) y = vna.ask_for_values(“fma;ofd;“) VNA Frontpanel Keypoints ,[object Object]
Directly process & analyze measured data
Fast, flexible programming
Not toomuchworryingabouttechnicaldetails…
VNA exampleusesPyQtfortheuserinterface,[object Object]
Data Analysis   http://www.scipy.org                                                 http://numpy.scipy.org
SciPy & NumPyExample importscipy.optimize #Define the model to befitted fitfunc= lambda p, x: p[0]+p[1]* exp(-x*abs(p[2]))*cos(p[3]+p[4]*x) #Define the errorfunction errfunc = lambda p, x, y: fitfunc(p, x)– y #Make a fit by minimizing the errorfunction p1 = scipy.optimize.fmin(lambdap,x,y:  norm(errfunc(p,x,y)), p0, args=(data [:,0], data[:,1])) #Print the returnedparameters print p1 #Plot the data and the fit… plot(data[:,0], data[:,1], "ro", data[:,0],  fitfunc(p1, data[:,0]), "b-") #Add a legend legend(("data","fit")) #Add a title title("Ramsey - $V_{fluxline}= %d mV$,  	$T_2 = %d$ ns, $A = %f$ " % (int(voltage) 	, abs(int(1.0/p1[2])),p1[1]))
Presentation & Visualization http://matplotlib.sourceforge.net/                            http://qt.nokia.com/
MatplotlibExamples grid()#Add gridlinestotheplot #Plot 4 datasets plot(x1,y1,x2,y2,x3,y3,x4,y4) #Add a legend legend((“Amplification…“,“…“)) #Set theaxislabels xlabel(“frequency[GHz]“) ylabel(“attenuation[dB]“) #Save thefigureas a PDF savefig(“attenuation.pdf“) jet() #Select a colorsheme #Plot the matrix imshow(dataMatrix,aspect = 'auto',origin = 'lower',extent = (xmin,xmax,ymin,ymax)) xlabel("$A$ [V]") ylabel("$f$ [GHz]") #Use Latex for text… title("Qubit 1 – Modulated by $V_{flux2} = A dot in{(20 MHz dot 2i t)}$")
Somemoreexamples…
PyQTExample: Instrument frontpanels title = QLabel(„Qubit 1") splitter = QSplitter(Qt.Horizontal) SetButton= QPushButton("Set") splitter.addWidget(SetButton) #... grid = QGridLayout(self) grid.addWidget(title,0,0) grid.addWidget(QLabel("Voltage"),1,0) #... self.connect(SetButton,SIGNAL("clicked()"),self.changeVoltage)self.setLayout(grid) Or use Qt Designer:

Contenu connexe

Tendances

Tendances (20)

A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
3. basic data structures(2)
3. basic data structures(2)3. basic data structures(2)
3. basic data structures(2)
 
Queue in swift
Queue in swiftQueue in swift
Queue in swift
 
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Use the Matplotlib, Luke @ PyCon Taiwan 2012Use the Matplotlib, Luke @ PyCon Taiwan 2012
Use the Matplotlib, Luke @ PyCon Taiwan 2012
 
TF.data & Eager Execution
TF.data & Eager ExecutionTF.data & Eager Execution
TF.data & Eager Execution
 
OCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchOCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API Search
 
Py lecture5 python plots
Py lecture5 python plotsPy lecture5 python plots
Py lecture5 python plots
 
Docopt
DocoptDocopt
Docopt
 
Sorter
SorterSorter
Sorter
 
Problemas de Arreglos en c++
Problemas de Arreglos en c++Problemas de Arreglos en c++
Problemas de Arreglos en c++
 
tf.data: TensorFlow Input Pipeline
tf.data: TensorFlow Input Pipelinetf.data: TensorFlow Input Pipeline
tf.data: TensorFlow Input Pipeline
 
Pointers
PointersPointers
Pointers
 
Introduction to cython
Introduction to cythonIntroduction to cython
Introduction to cython
 
Macro and Preprocessor in c programming
 Macro and  Preprocessor in c programming Macro and  Preprocessor in c programming
Macro and Preprocessor in c programming
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
 
Pythonで機械学習入門以前
Pythonで機械学習入門以前Pythonで機械学習入門以前
Pythonで機械学習入門以前
 
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnGoptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
 
STL
STLSTL
STL
 
Intoduction to dynamic memory allocation
Intoduction to dynamic memory allocationIntoduction to dynamic memory allocation
Intoduction to dynamic memory allocation
 
Brief Introduction to Cython
Brief Introduction to CythonBrief Introduction to Cython
Brief Introduction to Cython
 

En vedette

Ovarian hyperstimulation syndrome
Ovarian hyperstimulation syndromeOvarian hyperstimulation syndrome
Ovarian hyperstimulation syndrome
Hesham Gaber
 
Ovarian Hyperstimulation Syndrome
Ovarian Hyperstimulation SyndromeOvarian Hyperstimulation Syndrome
Ovarian Hyperstimulation Syndrome
guest9dc181
 

En vedette (9)

"The study of language" - Chapter 18
"The study of language" - Chapter 18"The study of language" - Chapter 18
"The study of language" - Chapter 18
 
ovarian hyperstimulation syndrome
ovarian hyperstimulation syndromeovarian hyperstimulation syndrome
ovarian hyperstimulation syndrome
 
The study of language. Chapter 19pptx
The study of language. Chapter 19pptxThe study of language. Chapter 19pptx
The study of language. Chapter 19pptx
 
"The study of language" - Chapter 20
"The study of language" - Chapter 20"The study of language" - Chapter 20
"The study of language" - Chapter 20
 
The study of language
The study of language The study of language
The study of language
 
Python For Scientists
Python For ScientistsPython For Scientists
Python For Scientists
 
The study of language
The study of languageThe study of language
The study of language
 
Ovarian hyperstimulation syndrome
Ovarian hyperstimulation syndromeOvarian hyperstimulation syndrome
Ovarian hyperstimulation syndrome
 
Ovarian Hyperstimulation Syndrome
Ovarian Hyperstimulation SyndromeOvarian Hyperstimulation Syndrome
Ovarian Hyperstimulation Syndrome
 

Similaire à Python for Scientists

Python-GTK
Python-GTKPython-GTK
Python-GTK
Yuren Ju
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
g3_nittala
 

Similaire à Python for Scientists (20)

Machine learning with py torch
Machine learning with py torchMachine learning with py torch
Machine learning with py torch
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
A Map of the PyData Stack
A Map of the PyData StackA Map of the PyData Stack
A Map of the PyData Stack
 
Time Series Analysis for Network Secruity
Time Series Analysis for Network SecruityTime Series Analysis for Network Secruity
Time Series Analysis for Network Secruity
 
app4.pptx
app4.pptxapp4.pptx
app4.pptx
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Writing Faster Python 3
Writing Faster Python 3Writing Faster Python 3
Writing Faster Python 3
 
TensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkTensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache Spark
 
Python basic
Python basicPython basic
Python basic
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화
 
Spark Summit EU talk by Tim Hunter
Spark Summit EU talk by Tim HunterSpark Summit EU talk by Tim Hunter
Spark Summit EU talk by Tim Hunter
 
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Numerical tour in the Python eco-system: Python, NumPy, scikit-learnNumerical tour in the Python eco-system: Python, NumPy, scikit-learn
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
 
Pres_python_talakhoury_26_09_2023.pdf
Pres_python_talakhoury_26_09_2023.pdfPres_python_talakhoury_26_09_2023.pdf
Pres_python_talakhoury_26_09_2023.pdf
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Introduction to Python and Matplotlib
Introduction to Python and MatplotlibIntroduction to Python and Matplotlib
Introduction to Python and Matplotlib
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 

Plus de Andreas Dewes

Plus de Andreas Dewes (8)

Fairness and Transparency in Machine Learning
Fairness and Transparency in Machine LearningFairness and Transparency in Machine Learning
Fairness and Transparency in Machine Learning
 
Type Annotations in Python: Whats, Whys and Wows!
Type Annotations in Python: Whats, Whys and Wows!Type Annotations in Python: Whats, Whys and Wows!
Type Annotations in Python: Whats, Whys and Wows!
 
Analyzing data with docker v4
Analyzing data with docker   v4Analyzing data with docker   v4
Analyzing data with docker v4
 
Say "Hi!" to Your New Boss
Say "Hi!" to Your New BossSay "Hi!" to Your New Boss
Say "Hi!" to Your New Boss
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...
 
Learning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysisLearning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysis
 
Let's build a quantum computer!
Let's build a quantum computer!Let's build a quantum computer!
Let's build a quantum computer!
 
Demonstrating Quantum Speed-Up with a Two-Transmon Quantum Processor Ph.D. d...
Demonstrating Quantum Speed-Up  with a Two-Transmon Quantum Processor Ph.D. d...Demonstrating Quantum Speed-Up  with a Two-Transmon Quantum Processor Ph.D. d...
Demonstrating Quantum Speed-Up with a Two-Transmon Quantum Processor Ph.D. d...
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Python for Scientists

  • 1. Python forScientists Dewes Quantronics Group Seminar
  • 2. Python: Qu'est-ce que c'est? Multi-paradigm (objectoriented, functional…) print“Easy as…“ fori in [1,2,3]: printi ctypes,sockets,files,regex,… Matplotlib,SciPy,NumPy,PyQT,…
  • 6. Data Acquisition http://pyvisa.sourceforge.net http://docs.python.org/library/ctypes.html
  • 7.
  • 8. Directly process & analyze measured data
  • 11.
  • 12. Data Analysis http://www.scipy.org http://numpy.scipy.org
  • 13. SciPy & NumPyExample importscipy.optimize #Define the model to befitted fitfunc= lambda p, x: p[0]+p[1]* exp(-x*abs(p[2]))*cos(p[3]+p[4]*x) #Define the errorfunction errfunc = lambda p, x, y: fitfunc(p, x)– y #Make a fit by minimizing the errorfunction p1 = scipy.optimize.fmin(lambdap,x,y: norm(errfunc(p,x,y)), p0, args=(data [:,0], data[:,1])) #Print the returnedparameters print p1 #Plot the data and the fit… plot(data[:,0], data[:,1], "ro", data[:,0], fitfunc(p1, data[:,0]), "b-") #Add a legend legend(("data","fit")) #Add a title title("Ramsey - $V_{fluxline}= %d mV$, $T_2 = %d$ ns, $A = %f$ " % (int(voltage) , abs(int(1.0/p1[2])),p1[1]))
  • 14. Presentation & Visualization http://matplotlib.sourceforge.net/ http://qt.nokia.com/
  • 15. MatplotlibExamples grid()#Add gridlinestotheplot #Plot 4 datasets plot(x1,y1,x2,y2,x3,y3,x4,y4) #Add a legend legend((“Amplification…“,“…“)) #Set theaxislabels xlabel(“frequency[GHz]“) ylabel(“attenuation[dB]“) #Save thefigureas a PDF savefig(“attenuation.pdf“) jet() #Select a colorsheme #Plot the matrix imshow(dataMatrix,aspect = 'auto',origin = 'lower',extent = (xmin,xmax,ymin,ymax)) xlabel("$A$ [V]") ylabel("$f$ [GHz]") #Use Latex for text… title("Qubit 1 – Modulated by $V_{flux2} = A dot in{(20 MHz dot 2i t)}$")
  • 17. PyQTExample: Instrument frontpanels title = QLabel(„Qubit 1") splitter = QSplitter(Qt.Horizontal) SetButton= QPushButton("Set") splitter.addWidget(SetButton) #... grid = QGridLayout(self) grid.addWidget(title,0,0) grid.addWidget(QLabel("Voltage"),1,0) #... self.connect(SetButton,SIGNAL("clicked()"),self.changeVoltage)self.setLayout(grid) Or use Qt Designer:
  • 18. HowToGetStarted 1. Download it… 2. Check out thedocumentation & tutorial (online) 3. Go &contributetotheWiki 4. Askyourcolleagues… http://www.python.org http://docs.python.org/tutorial/ http://wiki-quantro.extra.cea.fr
  • 20. Object HirarchyExample Dispatcher Subject Reloadable ThreadedDispatcher Instrument RemoteInstrument VisaInstrument VNA AgilentMWG Yokogawa Acqiris