DOC PREVIEW
CU-Boulder CSCI 5448 - Scientific Visualization

This preview shows page 1-2-23-24 out of 24 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Scientific Visualization with wxPython and Matplotlib Scott Pearse CSCI 5448 Spring 2011In this presentation, you will be shown how to use wxPython and Matplotlib to help you eliminate annoying inefficiencies that may exist in your scientific analysis! About: What is WxPython?? 1) A wrapper for the GUI API "WxWidgets", written in C++ 2) An alternative to PyQt and Tkinter 3) First modern version released in 1998 wxPython In Action The primary reference manual for wxPython, written by Robin DunnWhat is Matplotlib?? 1) An extension that allows the easy generation of a variety of graphs, including 3D plotting. 2) Contains tools for basic graph functions such as axis manipulation. Examples of a histogram, topography, and radial mapping made with MatplotlibPresentation Outline • Part 1 - How Pixelpicker was made with wxPython – How to make a frame – How to customize a frame – How to add widgets – How to add click events • Part 2 – Add plots to our application – How to make a plot – How to make it interact with our program This presentation is divided into two parts. The first deals with how to make a basic GUI with wxpython. The second explains how to apply a plot into our application.Making Pixelpicker with wxPython What is PixelPicker? • Pixelpicker is a tool I needed to help me identify anomalous radar data, which is routinely found in NEXRAD WSR-88D precipitation sensors. • Pixelpicker allows the user to select pixels that just look bad from a summation image that spans an arbitrary period of data.Radar Anomalies Include: • Bad Pixels – Pixels that are just stinkin bad – Can be caused by ground clutter (ie tall buildings or non-ideal topography) – Bad pixel example shown on the right, in red. This one actually measures in the hundreds of inches of rain, as opposed to its neighbors which are in the tens of inches. • Cones of Silence – WSR-88D stations are located on the ground, and their radar signals propogate outward at ~1 degree from the ground. – This means that there is a radius around the station where the radar waveform is (typically) too low to intercept clouds or precip – Even if there's a big cloud directly above the radar station or its nearby area, the station will not receive data from the because its waveform does not intercept it. This area is called a 'cone of silence'. – Cone of silence can be seen in the image to the right, in the lower left corner.Radar Anomalies (continued) • Radar extent discontinuities – WSR-88D weather stations have a typical range of 230km (this can be highly modified by engineers at the radar site) – When creating a 'mosaic' image of radar data, these extents overlap, and are not always continuous. – Identification of these boundaries is necessary for 'radar smoothing‘ – One discontinuity can be seen in the picture on the right, spanning the lower left corner. • Brightband Reflectivity – Radar signals are interpreted by their reflection off of water particles in the atmosphere – However the reflectivity of these particles changes dramatically with varying atmospheric conditions. – Snow and ice have a high reflectivity coefficient, and return a high percentage of incident radiation. – This phenomenon results in what looks like high amounts of precipitation, and is referred to as ‘brightbanding’.Why use wxPython to make tools like Pixelpicker? The old way to identify radar discontinuities was to write out the # of each pixel into a text document, then forward this doc for further processing. This meant using the mouse to scroll to the pixel in question (via another wxPython application that identifies pixel numbers), then scrolling back to the editor to write its value. The user would sometimes lapse across thousands of iterations of this process, and it was insanely inefficient. It's much easier to just click on a radar pixel, and have a program document which pixel was clicked. Not every job in the world is this mundane or inefficient, but they are out there. If we can create tools to visually represent scientific data, and leave the monotony to the machines, our lives will be better. Enter wxPython.First, lets reiterate and elaborate on the topics that will be covered in this brief wxPython tutorial: Step 1: Make a Frame Every wxap needs a frame, the mother of all widgets. Step 2: Customize the Frame 2a) Split the frame in half - This is convinient for the separating the visualization of the data (the radar pixels in this case), and the tools that work upon it. 2b) Add a status bar - Status bars can contain valuable information about data that the user simply has to scroll over in order to view.Reiteration and Elaboration (continued) Step 3: Add Widgets These will be the workhorse of our program, and will implement t are needed to get acutal work done For some of you, these terms may be new. On the next slide, we have a visual diagram of pixelpicker, with labels to associate these terms with.wxPython Terminology DiagramMake a Frame The code below comprises the simplest wxPython application ever concieved. It creates our "Frame", (also referred to as a window) that will contain all of the widgets and tools that we will define later in the program.What does it mean? This is our basic constructor for the frame. It will be heavily added to later on, so we can initialize a window that is much nicer and very fancy :) Note that the frame's size is declaired in its constructor as a tuple data type wx.App initializes the underlying GUI toolkit for WxPython. Every application needs this! Initialize our frame, which is implemented above Show our frame! If necessary, frame.Hide() can be called which does the opposite. This can be used for 'tabs' in a preferences menu. #This keeps our GUI in a continuous loop that is ready to receive key events from the user. It does not return until the program closes! These calls are the backbone of every wxPython application. Each program needs these calls for the program to initialize and function properly. What does it mean?Now that we've created our frame, we need to articulate our needs and customize it! There are a plethora of utilities that frames implement. For simplicity's sake I am going to emphasize two that I consistently use in my scientific wxPython applications. The first is a


View Full Document

CU-Boulder CSCI 5448 - Scientific Visualization

Documents in this Course
Django

Django

42 pages

ENRS

ENRS

30 pages

PhoneGap

PhoneGap

22 pages

Load more
Download Scientific Visualization
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Scientific Visualization and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Scientific Visualization 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?