SlideShare ist ein Scribd-Unternehmen logo
1 von 71
Downloaden Sie, um offline zu lesen
Scientific Applications using Python

                                    Travis E. Oliphant


                                         Oct 12, 2010



Tuesday, October 12, 2010
Graduate degree in Electrical Engineering




                            Began an appreciation
                            for Inverse Problems!




Tuesday, October 12, 2010
Graduate Degree in Biomedical Engineering
                                                                       UY (a, f )

                                      UX (a, f )




                                                               UZ (a, f )
                            2
               ρ0 (2πf ) Ui (a, f ) = [Cijkl (a, f ) Uk,l (a, f )],j


Tuesday, October 12, 2010
NumPy Array

            A NumPy array is an N-dimensional
               homogeneous collection of “items” of
               the same “kind”. The kind can be
               any arbitrary structure and is
               specified using the data-type.




Tuesday, October 12, 2010
SciPy [ Scientific Algorithms ]
SciPy                         linalg              stats            interpolate

                              cluster         special              maxentropy

                                io            fftpack                 odr

                             ndimage          sparse                integrate

                              signal         optimize                weave

                            NumPy [ Data Structure Core ]
                                              fft         random       linalg

                                  NDArray                     UFunc
                              multi-dimensional             fast array
                                array object              math operations

                                              Python


Tuesday, October 12, 2010
Assistant Professor of EE
                            Electromagnetics        Signal Processing




   Probability Theory


                                         Inverse
                                         Problems




Tuesday, October 12, 2010
SciPy

        Unique Visitors

        2009
        1,073,799

        2010 (first half)
        687,814




Tuesday, October 12, 2010
In 2009




 North America




Tuesday, October 12, 2010
In 2009




           Europe




Tuesday, October 12, 2010
SciPy Unique Visits
                        Universities (.edu)                               Labs (.gov)
                Location        2009          2010             Location        2009     2010

        MIT                     2631          1448     NASA                    1937     1060

        Stanford                1374          1074     NOAA                    412      317

        Berkeley                1504           813     Sandia                  236      236

        Harvard                 1493           768     LLNL                    246      232

        CalTech                 1345           711     NIH                     338      193

        U Wash                   954           701     LBL                     295      190

        Cornell                  849           683     NIST                    288      162

        Cambridge                968           613     FNL                     179      147
        U Mich                   708           560     USGS                    190      116

        Oxford                   708           443     BNL                     179      109

        ...                      ...           ...     ...                     ...       ...

        Total                   49,857        33,068   Total                  7,223     4,157




Tuesday, October 12, 2010
Enthought’s Business




Tuesday, October 12, 2010
Enthought’s Customers




Tuesday, October 12, 2010
Tuesday, October 12, 2010
Tuesday, October 12, 2010
Tuesday, October 12, 2010
Tuesday, October 12, 2010
Three Classes of Users
                    NOVICE   EXPERIENCED   EXPERT




Tuesday, October 12, 2010
Scripting Layer in Applications




                      Testing Framework Scripting Interface              Data Display
             Equipment           Compliance     Scientific    Database   Chaco         UI
              Interface            Tools       Algorithms      Access    Plotting   Elements




Tuesday, October 12, 2010
Scripting Layer in Applications




                      Testing Framework Scripting Interface              Data Display
             Equipment           Compliance     Scientific    Database   Chaco         UI
              Interface            Tools       Algorithms      Access    Plotting   Elements




Tuesday, October 12, 2010
Rich Client App (Geophysics, Finance, Etc)
                               Scripting Interface                      Data Display
              Equipment         Compliance      Scientific   Database   Chaco         UI
               Interface          Tools        Algorithms     Access    Plotting   Elements




Tuesday, October 12, 2010
VMA – Virtual Mixing Advisor




Tuesday, October 12, 2010
7 Heresies of Technical Computing




Tuesday, October 12, 2010
Heresy #1

          Computer memory will always be limited




                            Complexity
                             Software

                                         Memory




Tuesday, October 12, 2010
Heresy #1

            • There will always be a larger problem than
              can fit in available memory.
            • While automatic memory management
              can be useful --- programmer should be
              able to get access to lower-level if
              needed.




Tuesday, October 12, 2010
Heresy #2
            There will always be a hierarchy of
            computer memory: fast -> slow




Tuesday, October 12, 2010
Heresy #2

        • Single-memory model while powerful and
          useful, interferes with the ability to write
          programs that are optimal on modern
          hardware.
        • Hiding the network layer can be disastrous to
          usability
        • Different memory speeds require different
          approaches to manage



Tuesday, October 12, 2010
Heresy #3
       There will be no magic concurrency
       solution




Tuesday, October 12, 2010
Heresy #3

        • Python’s GIL can be a blessing
        • Use appropriate tools for the job
              –     zeromq
              –     multiprocessing
              –     subprocess
              –     threaded libraries (LAPACK, BLAS, FFT, etc.)
              –     OpenMP in extensions




Tuesday, October 12, 2010
Heresy #4
            Rapid prototyping via interactive
            programming leads to better results
            than extensive up-front planning




Tuesday, October 12, 2010
Heresy #4

        • You rarely know exactly what you want the
          finished software to do
        • Initial ideas lead to further refinement
        • Interactively developing pieces of code is a
          form of test-driven development
        • No hard data, but experience indicates it
          results in fewer bugs and easier to maintain
          software



Tuesday, October 12, 2010
Heresy #5
            Multi-platform rich client software will
            always be relevant




Tuesday, October 12, 2010
Heresy #5

        • In-browser applications are still complicated
          and expensive to write well
        • Data and I/O intensive applications still need
          a local client
        • Browser will not be the only rich client
          running internet applications




Tuesday, October 12, 2010
Heresy #6
     Object-oriented programming is over-used




Tuesday, October 12, 2010
Heresy #6
           Paul Graham (a partner in Y combinator, and author
           of Viaweb, the first web-based application):

                            the purpose of OOP is to act as a “herding
                            mechanism” which keeps mediocre
                            programmers in mediocre organizations
                            from “doing too much damage”. This is at
                            the expense of slowing down productive
                            programmers who know how to use more
                            powerful and more compact techniques.



Tuesday, October 12, 2010
Heresy #7

             The most important aspect of software
             development will always be people




Tuesday, October 12, 2010
Heresy #7
        • Syntax matters
        • Comments matter
        • Unit testing matter
        • Shared abstractions matter
        • Communication matters
        • DVCS matters
        • Limitations of the human brain
        • There will always be a level at which people
          are putting together the final level.

Tuesday, October 12, 2010
Heresy #7
          Programs should be written for people to read, and only incidentally for
          machines to execute.
                         Structure and Interpretation of Computer Programs
                         Harold Abelson and Gerald Sussman

         You need to have empathy not just for your users, but for your readers.
         It's in your interest, because you'll be one of them. Many a hacker has
         written a program only to find on returning to it six months later that
         he has no idea how it works.
                           Hackers and Painters
                           Paul Graham

        Debugging is twice as hard as writing the code in the first place.
        Therefore, if you write the code as cleverly as possible, you are, by
        definition, not smart enough to debug it.
                         Brian Kernighan
                         co-author of “The C Programming Language”



Tuesday, October 12, 2010
Why Python?
             “A programmer can be 5-10 times more
               productive in Python than in Java.”
             http://pythonconquerstheuniverse.wordpress.com/category/java-and-python/




Tuesday, October 12, 2010
What is Python?
     ONE LINER

    Python is an interpreted programming language that allows you to do almost anything
    possible with a compiled language (C/C++/Fortran) without requiring all the complexity.




     PYTHON HIGHLIGHTS


    • Automatic garbage collection                  • “Batteries Included”
    • Dynamic typing                                • Free
    • Interpreted and interactive                   • Portable
    • Object-oriented                               • Easy to Learn and Use
                                                    • Truly Modular




Tuesday, October 12, 2010
Program Size and Programmer Efficiency

             Quantitative language study based on 80 programmers implementing the
             same program. The program maps telephone numbers into strings of words
             according to a given dictionary and a fixed digit-to-character encoding.

             http://www.ipd.uka.de/~prechelt/Biblio/jccpprtTR.pdf




Tuesday, October 12, 2010
Language CPU/Memory




Tuesday, October 12, 2010
(Very) Short comparison
      PYTHON                                 JAVA

     • Permissive philosophy                 • Strict protective rules intended to prevent
                                               errors
     • Simple syntax.                        • Complex syntax.
     • Excels as “glue” between other        • Designed as implementation language akin
       languages such as C/C++/Fortran         to C/C++
     • Scriptible – allows expert users to   • Not scriptable, although secondary options
       extend the application natively.        exists (Jython, Bean Shell, Rhino)

                                             • No support for complex numbers
     • Supports complex numbers natively
                                             • No native support for multi-dimensional
     • Supports multi-dimensional arrays       arrays
     • Supports operator overloading         • No support for operator overloading
         a + b * c                                  a.add(b.multiply(c))




Tuesday, October 12, 2010
Output to a File Comparison
      PYTHON
      f = open(‘demo.txt’,’w’)
      print >> f, “hello”, 42
      f.close()


      JAVA
      import java.io.*;
      public class HelloClient {
          public static void main(String args[]) {
                  String hi = "Hello World!";
                  int i = 42;
                  FileOutputStream f = new FileOutputStream("demo.txt");
                  PrintWriter pw = new PrintWriter(f);
                  pw.println(hi);
                  pw.println(Integer.toString(i));
                  pw.close();
          }
      }




Tuesday, October 12, 2010
Universe of Software Users




        End User              Research        Research Scientist/      Computer
   Scientist/Technician       Scientist          Programmer            Architect

           Only Uses         Occasionally          Research            Cares (and
            Features        wants to modify        Scientist          knows) more
         provided by UI      an application         by day,           about object
                                to work         programmer by       hierarchies than
                              “their way”            night.             science




Tuesday, October 12, 2010
Universe of Software Users

                                Typical “Degree of Difficulty” Curve




        End User              Research        Research Scientist/      Computer
   Scientist/Technician       Scientist          Programmer            Architect

           Only Uses         Occasionally          Research            Cares (and
            Features        wants to modify        Scientist          knows) more
         provided by UI      an application         by day,           about object
                                to work         programmer by       hierarchies than
                              “their way”            night.             science




Tuesday, October 12, 2010
Universe of Software Users

                              Desired “Degree of Difficulty” Curve




        End User              Research        Research Scientist/      Computer
   Scientist/Technician       Scientist          Programmer            Architect

           Only Uses         Occasionally          Research            Cares (and
            Features        wants to modify        Scientist          knows) more
         provided by UI      an application         by day,           about object
                                to work         programmer by       hierarchies than
                              “their way”            night.             science




Tuesday, October 12, 2010
Tuesday, October 12, 2010
Who is Using Python?
      WALL STREET                              GOOGLE
      Banks and hedge funds rely on Python     One of top three languages used at
      for their high speed trading systems,    Google along with C++ and Java.
      data analysis, and visualization.        Guido works there.


      HOLLYWOOD                                YOUTUBE
      Digital animation and special effects:   Highly scalable web application for
      • Industrial Light and Magic             delivering video content.
      • Imageworks
      • Tippett Studios                        REDHAT
      • Disney                                 Anaconda, the Redhat Linux installer
      • Dreamworks                             program, is written in Python.

      PETROLEUM INDUSTRY                       PROCTER & GAMBLE
     Geophysics and exploration tools:         Fluid dynamics simulation tools.
     • ConocoPhillips
     • Shell



Tuesday, October 12, 2010
How we use Python?




Tuesday, October 12, 2010
IPython




Tuesday, October 12, 2010
Structured Arrays
 Elements of array can be any                           Example
 fixed-size data structure.
                                                        >>> from numpy import dtype, empty
                                                        # structured data format
                      Name char[10]                     >>> fmt =dtype ([(‘name’, ‘S10’),
                      Age int                                           (‘age’, int),
                                                                        (‘weight’, float)])
                      Weight double
                                                        >>> a = empty ((3,4), dtype=fmt)
                                                        >>> a.itemsize
        Brad                Jane     John       Fred    22
                                                        >>> a[‘name’] = [[‘Brad’, ... , ‘Jill’]]
        33                  25       47         54      >>> a[‘age’] = [[33, ... , 54]]
        135.0               105.0    225.0      140.0   >>> a[‘weight’] = [[135, ... , 145]]
                                                        >>> print a
        Henry               George   Brian      Amy     [[(‘Brad’, 33, 135.0)
        29                  61       32         27          ...
                                                           (‘Jill’, 54, 145.0)]]
        154.0               202.0    137.0      187.0
        Ron                 Susan    Jennifer   Jill
        19                  33       18         54
        188.0               135.0    88.0       145.0




Tuesday, October 12, 2010
Nested Datatype




                            52

Tuesday, October 12, 2010
Nested Datatype
    dt = dtype([('time', uint64),
                            ('size', uint32),
                            ('position', [('az', float32),
                                          ('el', float32),
                                          ('region_type', uint8),
                                          ('region_ID', uint16)]),
                            ('gain', np.uint8),
                            ('samples', np.int16, 2048)])


    data = np.fromfile(f, dtype=dt)




                                                                     53

Tuesday, October 12, 2010
Structured Arrays
           Name                    Time          Value         Example
         char[12]                  int64         float32
                                                               >>> import numpy as np
    MSFT_profit                10             6.20              >>> fmt =np.dtype ([(‘name’, ‘S12’),
                                                                               (‘time’, np.int64),
    GOOG_profit                12             -1.08                             (‘value’, np.float32)])

    MSFT_profit                18             8.40              >>> vals = [('MSFT_profit', 10, 6.20),
                                                                           ('GOOG_profit', 12, -1.08),
    INTC_profit                25             -0.20




                                                                                                …
                                                                              ('GOOG_profit', 1000385, -1.05)
                                                                              ('MSFT_profit', 1000390, 5.60)]

    GOOG_profit                1000325        3.20              >>> arr = np.array(vals, dtype=fmt)
                                                               # or
    GOOG_profit                1000350        4.50              >>> arr = np.fromfile('db.dat', dtype=fmt)
                                                               # or
    INTC_profit                1000385        -1.05             >>> arr = np.memmap('db.dat', dtype=fmt,
                                                               !        !           mode='c')
    MSFT_profit                1000390        5.60



   MSFT_profit         10    6.20    GOOG_profit    12   -1.08     INTC_profit   1000385   -1.05   MSFT_profit   1000390   5.60




Tuesday, October 12, 2010
Memory Mapped Example

                                   # Create a “memory mapped array where
                                   # the array data is stored in a file on
                                   # disk instead of in main memory.
                                   >>> from numpy import memmap
                                   >>> image =(‘some_file.dat’,
              image:
                                                dtype = uint16,
                  2D NumPy array
                  shape: 5,5                    mode= ‘r+’,
                  dtype: uint16                 mode= (5,5),
                                                offset = header_size)
                                   # Standard array methods work.
                                   >>> mean_value = image.mean()

                                   # Standard math operations work.
               some_file.dat        # The resulting scaled_image *is*
               <header> 110111…
                                   # stored in main memory. It is a
               <data> 0110000001
                                   # standard numpy array.
               0010010111011000
               1101001001000100    >>> scaled_image = image * .5
               1111010101000010
               0010111000101011
               00011110101011…




Tuesday, October 12, 2010
SciPy [ Scientific Algorithms ]
                              linalg                 stats              interpolate
                              cluster               special           maxentropy
                                io                  fftpack                odr
                             ndimage                sparse              integrate
                              signal                optimize              weave

                            NumPy [ Data Structure Core ]
                                                    fft        random       linalg
                                    NDArray                        UFunc
                                multi-dimensional                fast array
                                  array object                 math operations




Tuesday, October 12, 2010
Static Plotting



                     John Hunter
                     2001



Tuesday, October 12, 2010
Enthought Tool Suite




Tuesday, October 12, 2010
Chaco: Interactive Graphics




Tuesday, October 12, 2010
Tuesday, October 12, 2010
Multiple Plug-ins. One Application




Tuesday, October 12, 2010
Envisage Application Framework Goals
  • Extensible              • “Humane” Interface Tools built-in
  • Scriptable              • Easy Deployment




Tuesday, October 12, 2010
Enthought Python Distribution (EPD)




Tuesday, October 12, 2010
Software Application Layers


                                  Domain Specific GUI Applications
                     Semiconductor, Fluid Dynamics, Seismic Modeling, Financial, etc.

                                             ETS (App construction)
                                       Traits, Chaco, Envisage, Mayavi, etc.

                            SciPy (Scientific Algorithms)            3rd Party Libraries
                                                                          wxPython
                            NumPy (Array Mathematics)                     VTK, etc.

                                                      Python




Tuesday, October 12, 2010
Fluid Characterization -- Micro-rheology




Tuesday, October 12, 2010
VMS – Virtual Mixing System

 •   Design Drawings
 •   Computational Fluid Dynamics
 •   Parallel Simulation
 •   Data Visualization




Tuesday, October 12, 2010
VMA – Virtual Mixing Advisor




Tuesday, October 12, 2010
Oil & Gas                                                    Shell
           Stochastic Seismic Analysis    Pore Pressure Analysis




               Electromagnetic Analysis   Seismic Visualization




Tuesday, October 12, 2010
Army Research Labs (ARL)
  • Electromagnetics Simulation   • Fine grained Parallelism (MPI based)
  • Python/C/Fortan90             • Desktop Application
                                  • Cluster Execution




Tuesday, October 12, 2010
High Speed Signal
Integrity Testing




Tuesday, October 12, 2010
Dental Surgery Planning




Tuesday, October 12, 2010

Weitere ähnliche Inhalte

Ähnlich wie Scientific Applications with Python

Riak Core: Building Distributed Applications Without Shared State
Riak Core: Building Distributed Applications Without Shared StateRiak Core: Building Distributed Applications Without Shared State
Riak Core: Building Distributed Applications Without Shared StateRusty Klophaus
 
DTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldDTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldAngelo Rajadurai
 
Python in the Atmospheric sciences
Python in the Atmospheric sciencesPython in the Atmospheric sciences
Python in the Atmospheric sciencesScott Collis
 
Python for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandasPython for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandasWes McKinney
 
Slides 111017220255-phpapp01
Slides 111017220255-phpapp01Slides 111017220255-phpapp01
Slides 111017220255-phpapp01Ken Mwai
 
Rental Cars and Industrialized Learning to Rank with Sean Downes
Rental Cars and Industrialized Learning to Rank with Sean DownesRental Cars and Industrialized Learning to Rank with Sean Downes
Rental Cars and Industrialized Learning to Rank with Sean DownesDatabricks
 
Los Angeles R users group - Nov 17 2010 - Part 2
Los Angeles R users group - Nov 17 2010 - Part 2Los Angeles R users group - Nov 17 2010 - Part 2
Los Angeles R users group - Nov 17 2010 - Part 2rusersla
 
Big Data @ Bodensee Barcamp 2010
Big Data @ Bodensee Barcamp 2010Big Data @ Bodensee Barcamp 2010
Big Data @ Bodensee Barcamp 2010c1sc0
 
Data Loading for Ext GWT
Data Loading for Ext GWTData Loading for Ext GWT
Data Loading for Ext GWTSencha
 
Collective Knowledge: python and scikit-learn based open research SDK for col...
Collective Knowledge: python and scikit-learn based open research SDK for col...Collective Knowledge: python and scikit-learn based open research SDK for col...
Collective Knowledge: python and scikit-learn based open research SDK for col...Grigori Fursin
 
iOS Development. Some practices.
iOS Development. Some practices.iOS Development. Some practices.
iOS Development. Some practices.Alexander Lobunets
 
An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...
An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...
An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...Darren Carlson
 
Adding Simplicity to Complexity
Adding Simplicity to ComplexityAdding Simplicity to Complexity
Adding Simplicity to ComplexityTheo Schlossnagle
 
Large problems, Mostly Solved
Large problems, Mostly SolvedLarge problems, Mostly Solved
Large problems, Mostly Solvedericholscher
 
Hao hsiang ma resume
Hao hsiang ma resumeHao hsiang ma resume
Hao hsiang ma resumeEliot Ma
 
THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...
THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...
THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...André Fucs de Miranda
 
Analysis Software Benchmark
Analysis Software BenchmarkAnalysis Software Benchmark
Analysis Software BenchmarkAkira Shibata
 
State of Puppet Amsterdam
State of Puppet AmsterdamState of Puppet Amsterdam
State of Puppet AmsterdamPuppet
 
The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...
The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...
The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...DataWorks Summit
 

Ähnlich wie Scientific Applications with Python (20)

Riak Core: Building Distributed Applications Without Shared State
Riak Core: Building Distributed Applications Without Shared StateRiak Core: Building Distributed Applications Without Shared State
Riak Core: Building Distributed Applications Without Shared State
 
DTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldDTrace talk at Oracle Open World
DTrace talk at Oracle Open World
 
Python in the Atmospheric sciences
Python in the Atmospheric sciencesPython in the Atmospheric sciences
Python in the Atmospheric sciences
 
Python for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandasPython for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandas
 
Slides 111017220255-phpapp01
Slides 111017220255-phpapp01Slides 111017220255-phpapp01
Slides 111017220255-phpapp01
 
Rental Cars and Industrialized Learning to Rank with Sean Downes
Rental Cars and Industrialized Learning to Rank with Sean DownesRental Cars and Industrialized Learning to Rank with Sean Downes
Rental Cars and Industrialized Learning to Rank with Sean Downes
 
Los Angeles R users group - Nov 17 2010 - Part 2
Los Angeles R users group - Nov 17 2010 - Part 2Los Angeles R users group - Nov 17 2010 - Part 2
Los Angeles R users group - Nov 17 2010 - Part 2
 
Big Data @ Bodensee Barcamp 2010
Big Data @ Bodensee Barcamp 2010Big Data @ Bodensee Barcamp 2010
Big Data @ Bodensee Barcamp 2010
 
Data Loading for Ext GWT
Data Loading for Ext GWTData Loading for Ext GWT
Data Loading for Ext GWT
 
Collective Knowledge: python and scikit-learn based open research SDK for col...
Collective Knowledge: python and scikit-learn based open research SDK for col...Collective Knowledge: python and scikit-learn based open research SDK for col...
Collective Knowledge: python and scikit-learn based open research SDK for col...
 
iOS Development. Some practices.
iOS Development. Some practices.iOS Development. Some practices.
iOS Development. Some practices.
 
An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...
An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...
An Ad-hoc Smart Gateway Platform for the Web of Things (IEEE iThings 2013 Bes...
 
Adding Simplicity to Complexity
Adding Simplicity to ComplexityAdding Simplicity to Complexity
Adding Simplicity to Complexity
 
Large problems, Mostly Solved
Large problems, Mostly SolvedLarge problems, Mostly Solved
Large problems, Mostly Solved
 
Marsyas
MarsyasMarsyas
Marsyas
 
Hao hsiang ma resume
Hao hsiang ma resumeHao hsiang ma resume
Hao hsiang ma resume
 
THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...
THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...
THE POWER OF INTELLIGENT FLOWS REAL-TIME IOT BOTNET CLASSIFICATION WITH APACH...
 
Analysis Software Benchmark
Analysis Software BenchmarkAnalysis Software Benchmark
Analysis Software Benchmark
 
State of Puppet Amsterdam
State of Puppet AmsterdamState of Puppet Amsterdam
State of Puppet Amsterdam
 
The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...
The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...
The Power of Intelligent Flows: Real-Time IoT Botnet Classification with Apac...
 

Mehr von Enthought, Inc.

Scientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviScientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviEnthought, Inc.
 
February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?Enthought, Inc.
 
Parallel Processing with IPython
Parallel Processing with IPythonParallel Processing with IPython
Parallel Processing with IPythonEnthought, Inc.
 
Scientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: TraitsScientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: TraitsEnthought, Inc.
 
Scientific Computing with Python Webinar 9/18/2009:Curve Fitting
Scientific Computing with Python Webinar 9/18/2009:Curve FittingScientific Computing with Python Webinar 9/18/2009:Curve Fitting
Scientific Computing with Python Webinar 9/18/2009:Curve FittingEnthought, Inc.
 
Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009Enthought, Inc.
 
Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Enthought, Inc.
 

Mehr von Enthought, Inc. (11)

Numpy Talk at SIAM
Numpy Talk at SIAMNumpy Talk at SIAM
Numpy Talk at SIAM
 
SciPy 2010 Review
SciPy 2010 ReviewSciPy 2010 Review
SciPy 2010 Review
 
Scientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviScientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
Scientific Computing with Python Webinar March 19: 3D Visualization with Mayavi
 
NumPy/SciPy Statistics
NumPy/SciPy StatisticsNumPy/SciPy Statistics
NumPy/SciPy Statistics
 
February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?February EPD Webinar: How do I...use PiCloud for cloud computing?
February EPD Webinar: How do I...use PiCloud for cloud computing?
 
SciPy India 2009
SciPy India 2009SciPy India 2009
SciPy India 2009
 
Parallel Processing with IPython
Parallel Processing with IPythonParallel Processing with IPython
Parallel Processing with IPython
 
Scientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: TraitsScientific Computing with Python Webinar: Traits
Scientific Computing with Python Webinar: Traits
 
Scientific Computing with Python Webinar 9/18/2009:Curve Fitting
Scientific Computing with Python Webinar 9/18/2009:Curve FittingScientific Computing with Python Webinar 9/18/2009:Curve Fitting
Scientific Computing with Python Webinar 9/18/2009:Curve Fitting
 
Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009Scientific Computing with Python Webinar --- August 28, 2009
Scientific Computing with Python Webinar --- August 28, 2009
 
Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009
 

Kürzlich hochgeladen

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Kürzlich hochgeladen (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Scientific Applications with Python

  • 1. Scientific Applications using Python Travis E. Oliphant Oct 12, 2010 Tuesday, October 12, 2010
  • 2. Graduate degree in Electrical Engineering Began an appreciation for Inverse Problems! Tuesday, October 12, 2010
  • 3. Graduate Degree in Biomedical Engineering UY (a, f ) UX (a, f ) UZ (a, f ) 2 ρ0 (2πf ) Ui (a, f ) = [Cijkl (a, f ) Uk,l (a, f )],j Tuesday, October 12, 2010
  • 4. NumPy Array A NumPy array is an N-dimensional homogeneous collection of “items” of the same “kind”. The kind can be any arbitrary structure and is specified using the data-type. Tuesday, October 12, 2010
  • 5. SciPy [ Scientific Algorithms ] SciPy linalg stats interpolate cluster special maxentropy io fftpack odr ndimage sparse integrate signal optimize weave NumPy [ Data Structure Core ] fft random linalg NDArray UFunc multi-dimensional fast array array object math operations Python Tuesday, October 12, 2010
  • 6. Assistant Professor of EE Electromagnetics Signal Processing Probability Theory Inverse Problems Tuesday, October 12, 2010
  • 7. SciPy Unique Visitors 2009 1,073,799 2010 (first half) 687,814 Tuesday, October 12, 2010
  • 8. In 2009 North America Tuesday, October 12, 2010
  • 9. In 2009 Europe Tuesday, October 12, 2010
  • 10. SciPy Unique Visits Universities (.edu) Labs (.gov) Location 2009 2010 Location 2009 2010 MIT 2631 1448 NASA 1937 1060 Stanford 1374 1074 NOAA 412 317 Berkeley 1504 813 Sandia 236 236 Harvard 1493 768 LLNL 246 232 CalTech 1345 711 NIH 338 193 U Wash 954 701 LBL 295 190 Cornell 849 683 NIST 288 162 Cambridge 968 613 FNL 179 147 U Mich 708 560 USGS 190 116 Oxford 708 443 BNL 179 109 ... ... ... ... ... ... Total 49,857 33,068 Total 7,223 4,157 Tuesday, October 12, 2010
  • 17. Three Classes of Users NOVICE EXPERIENCED EXPERT Tuesday, October 12, 2010
  • 18. Scripting Layer in Applications Testing Framework Scripting Interface Data Display Equipment Compliance Scientific Database Chaco UI Interface Tools Algorithms Access Plotting Elements Tuesday, October 12, 2010
  • 19. Scripting Layer in Applications Testing Framework Scripting Interface Data Display Equipment Compliance Scientific Database Chaco UI Interface Tools Algorithms Access Plotting Elements Tuesday, October 12, 2010
  • 20. Rich Client App (Geophysics, Finance, Etc) Scripting Interface Data Display Equipment Compliance Scientific Database Chaco UI Interface Tools Algorithms Access Plotting Elements Tuesday, October 12, 2010
  • 21. VMA – Virtual Mixing Advisor Tuesday, October 12, 2010
  • 22. 7 Heresies of Technical Computing Tuesday, October 12, 2010
  • 23. Heresy #1 Computer memory will always be limited Complexity Software Memory Tuesday, October 12, 2010
  • 24. Heresy #1 • There will always be a larger problem than can fit in available memory. • While automatic memory management can be useful --- programmer should be able to get access to lower-level if needed. Tuesday, October 12, 2010
  • 25. Heresy #2 There will always be a hierarchy of computer memory: fast -> slow Tuesday, October 12, 2010
  • 26. Heresy #2 • Single-memory model while powerful and useful, interferes with the ability to write programs that are optimal on modern hardware. • Hiding the network layer can be disastrous to usability • Different memory speeds require different approaches to manage Tuesday, October 12, 2010
  • 27. Heresy #3 There will be no magic concurrency solution Tuesday, October 12, 2010
  • 28. Heresy #3 • Python’s GIL can be a blessing • Use appropriate tools for the job – zeromq – multiprocessing – subprocess – threaded libraries (LAPACK, BLAS, FFT, etc.) – OpenMP in extensions Tuesday, October 12, 2010
  • 29. Heresy #4 Rapid prototyping via interactive programming leads to better results than extensive up-front planning Tuesday, October 12, 2010
  • 30. Heresy #4 • You rarely know exactly what you want the finished software to do • Initial ideas lead to further refinement • Interactively developing pieces of code is a form of test-driven development • No hard data, but experience indicates it results in fewer bugs and easier to maintain software Tuesday, October 12, 2010
  • 31. Heresy #5 Multi-platform rich client software will always be relevant Tuesday, October 12, 2010
  • 32. Heresy #5 • In-browser applications are still complicated and expensive to write well • Data and I/O intensive applications still need a local client • Browser will not be the only rich client running internet applications Tuesday, October 12, 2010
  • 33. Heresy #6 Object-oriented programming is over-used Tuesday, October 12, 2010
  • 34. Heresy #6 Paul Graham (a partner in Y combinator, and author of Viaweb, the first web-based application): the purpose of OOP is to act as a “herding mechanism” which keeps mediocre programmers in mediocre organizations from “doing too much damage”. This is at the expense of slowing down productive programmers who know how to use more powerful and more compact techniques. Tuesday, October 12, 2010
  • 35. Heresy #7 The most important aspect of software development will always be people Tuesday, October 12, 2010
  • 36. Heresy #7 • Syntax matters • Comments matter • Unit testing matter • Shared abstractions matter • Communication matters • DVCS matters • Limitations of the human brain • There will always be a level at which people are putting together the final level. Tuesday, October 12, 2010
  • 37. Heresy #7 Programs should be written for people to read, and only incidentally for machines to execute. Structure and Interpretation of Computer Programs Harold Abelson and Gerald Sussman You need to have empathy not just for your users, but for your readers. It's in your interest, because you'll be one of them. Many a hacker has written a program only to find on returning to it six months later that he has no idea how it works. Hackers and Painters Paul Graham Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. Brian Kernighan co-author of “The C Programming Language” Tuesday, October 12, 2010
  • 38. Why Python? “A programmer can be 5-10 times more productive in Python than in Java.” http://pythonconquerstheuniverse.wordpress.com/category/java-and-python/ Tuesday, October 12, 2010
  • 39. What is Python? ONE LINER Python is an interpreted programming language that allows you to do almost anything possible with a compiled language (C/C++/Fortran) without requiring all the complexity. PYTHON HIGHLIGHTS • Automatic garbage collection • “Batteries Included” • Dynamic typing • Free • Interpreted and interactive • Portable • Object-oriented • Easy to Learn and Use • Truly Modular Tuesday, October 12, 2010
  • 40. Program Size and Programmer Efficiency Quantitative language study based on 80 programmers implementing the same program. The program maps telephone numbers into strings of words according to a given dictionary and a fixed digit-to-character encoding. http://www.ipd.uka.de/~prechelt/Biblio/jccpprtTR.pdf Tuesday, October 12, 2010
  • 42. (Very) Short comparison PYTHON JAVA • Permissive philosophy • Strict protective rules intended to prevent errors • Simple syntax. • Complex syntax. • Excels as “glue” between other • Designed as implementation language akin languages such as C/C++/Fortran to C/C++ • Scriptible – allows expert users to • Not scriptable, although secondary options extend the application natively. exists (Jython, Bean Shell, Rhino) • No support for complex numbers • Supports complex numbers natively • No native support for multi-dimensional • Supports multi-dimensional arrays arrays • Supports operator overloading • No support for operator overloading a + b * c a.add(b.multiply(c)) Tuesday, October 12, 2010
  • 43. Output to a File Comparison PYTHON f = open(‘demo.txt’,’w’) print >> f, “hello”, 42 f.close() JAVA import java.io.*; public class HelloClient { public static void main(String args[]) { String hi = "Hello World!"; int i = 42; FileOutputStream f = new FileOutputStream("demo.txt"); PrintWriter pw = new PrintWriter(f); pw.println(hi); pw.println(Integer.toString(i)); pw.close(); } } Tuesday, October 12, 2010
  • 44. Universe of Software Users End User Research Research Scientist/ Computer Scientist/Technician Scientist Programmer Architect Only Uses Occasionally Research Cares (and Features wants to modify Scientist knows) more provided by UI an application by day, about object to work programmer by hierarchies than “their way” night. science Tuesday, October 12, 2010
  • 45. Universe of Software Users Typical “Degree of Difficulty” Curve End User Research Research Scientist/ Computer Scientist/Technician Scientist Programmer Architect Only Uses Occasionally Research Cares (and Features wants to modify Scientist knows) more provided by UI an application by day, about object to work programmer by hierarchies than “their way” night. science Tuesday, October 12, 2010
  • 46. Universe of Software Users Desired “Degree of Difficulty” Curve End User Research Research Scientist/ Computer Scientist/Technician Scientist Programmer Architect Only Uses Occasionally Research Cares (and Features wants to modify Scientist knows) more provided by UI an application by day, about object to work programmer by hierarchies than “their way” night. science Tuesday, October 12, 2010
  • 48. Who is Using Python? WALL STREET GOOGLE Banks and hedge funds rely on Python One of top three languages used at for their high speed trading systems, Google along with C++ and Java. data analysis, and visualization. Guido works there. HOLLYWOOD YOUTUBE Digital animation and special effects: Highly scalable web application for • Industrial Light and Magic delivering video content. • Imageworks • Tippett Studios REDHAT • Disney Anaconda, the Redhat Linux installer • Dreamworks program, is written in Python. PETROLEUM INDUSTRY PROCTER & GAMBLE Geophysics and exploration tools: Fluid dynamics simulation tools. • ConocoPhillips • Shell Tuesday, October 12, 2010
  • 49. How we use Python? Tuesday, October 12, 2010
  • 51. Structured Arrays Elements of array can be any Example fixed-size data structure. >>> from numpy import dtype, empty # structured data format Name char[10] >>> fmt =dtype ([(‘name’, ‘S10’), Age int (‘age’, int), (‘weight’, float)]) Weight double >>> a = empty ((3,4), dtype=fmt) >>> a.itemsize Brad Jane John Fred 22 >>> a[‘name’] = [[‘Brad’, ... , ‘Jill’]] 33 25 47 54 >>> a[‘age’] = [[33, ... , 54]] 135.0 105.0 225.0 140.0 >>> a[‘weight’] = [[135, ... , 145]] >>> print a Henry George Brian Amy [[(‘Brad’, 33, 135.0) 29 61 32 27 ... (‘Jill’, 54, 145.0)]] 154.0 202.0 137.0 187.0 Ron Susan Jennifer Jill 19 33 18 54 188.0 135.0 88.0 145.0 Tuesday, October 12, 2010
  • 52. Nested Datatype 52 Tuesday, October 12, 2010
  • 53. Nested Datatype dt = dtype([('time', uint64), ('size', uint32), ('position', [('az', float32), ('el', float32), ('region_type', uint8), ('region_ID', uint16)]), ('gain', np.uint8), ('samples', np.int16, 2048)]) data = np.fromfile(f, dtype=dt) 53 Tuesday, October 12, 2010
  • 54. Structured Arrays Name Time Value Example char[12] int64 float32 >>> import numpy as np MSFT_profit 10 6.20 >>> fmt =np.dtype ([(‘name’, ‘S12’), (‘time’, np.int64), GOOG_profit 12 -1.08 (‘value’, np.float32)]) MSFT_profit 18 8.40 >>> vals = [('MSFT_profit', 10, 6.20), ('GOOG_profit', 12, -1.08), INTC_profit 25 -0.20 … ('GOOG_profit', 1000385, -1.05) ('MSFT_profit', 1000390, 5.60)] GOOG_profit 1000325 3.20 >>> arr = np.array(vals, dtype=fmt) # or GOOG_profit 1000350 4.50 >>> arr = np.fromfile('db.dat', dtype=fmt) # or INTC_profit 1000385 -1.05 >>> arr = np.memmap('db.dat', dtype=fmt, ! ! mode='c') MSFT_profit 1000390 5.60 MSFT_profit 10 6.20 GOOG_profit 12 -1.08 INTC_profit 1000385 -1.05 MSFT_profit 1000390 5.60 Tuesday, October 12, 2010
  • 55. Memory Mapped Example # Create a “memory mapped array where # the array data is stored in a file on # disk instead of in main memory. >>> from numpy import memmap >>> image =(‘some_file.dat’, image: dtype = uint16, 2D NumPy array shape: 5,5 mode= ‘r+’, dtype: uint16 mode= (5,5), offset = header_size) # Standard array methods work. >>> mean_value = image.mean() # Standard math operations work. some_file.dat # The resulting scaled_image *is* <header> 110111… # stored in main memory. It is a <data> 0110000001 # standard numpy array. 0010010111011000 1101001001000100 >>> scaled_image = image * .5 1111010101000010 0010111000101011 00011110101011… Tuesday, October 12, 2010
  • 56. SciPy [ Scientific Algorithms ] linalg stats interpolate cluster special maxentropy io fftpack odr ndimage sparse integrate signal optimize weave NumPy [ Data Structure Core ] fft random linalg NDArray UFunc multi-dimensional fast array array object math operations Tuesday, October 12, 2010
  • 57. Static Plotting John Hunter 2001 Tuesday, October 12, 2010
  • 58. Enthought Tool Suite Tuesday, October 12, 2010
  • 61. Multiple Plug-ins. One Application Tuesday, October 12, 2010
  • 62. Envisage Application Framework Goals • Extensible • “Humane” Interface Tools built-in • Scriptable • Easy Deployment Tuesday, October 12, 2010
  • 63. Enthought Python Distribution (EPD) Tuesday, October 12, 2010
  • 64. Software Application Layers Domain Specific GUI Applications Semiconductor, Fluid Dynamics, Seismic Modeling, Financial, etc. ETS (App construction) Traits, Chaco, Envisage, Mayavi, etc. SciPy (Scientific Algorithms) 3rd Party Libraries wxPython NumPy (Array Mathematics) VTK, etc. Python Tuesday, October 12, 2010
  • 65. Fluid Characterization -- Micro-rheology Tuesday, October 12, 2010
  • 66. VMS – Virtual Mixing System • Design Drawings • Computational Fluid Dynamics • Parallel Simulation • Data Visualization Tuesday, October 12, 2010
  • 67. VMA – Virtual Mixing Advisor Tuesday, October 12, 2010
  • 68. Oil & Gas Shell Stochastic Seismic Analysis Pore Pressure Analysis Electromagnetic Analysis Seismic Visualization Tuesday, October 12, 2010
  • 69. Army Research Labs (ARL) • Electromagnetics Simulation • Fine grained Parallelism (MPI based) • Python/C/Fortan90 • Desktop Application • Cluster Execution Tuesday, October 12, 2010
  • 70. High Speed Signal Integrity Testing Tuesday, October 12, 2010