DOC PREVIEW
UMD ASTR 415 - Data Representation and Introduction to Visualization

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 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 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Class 5. Data Representation and Introduction to Vi-sualizationVisualization• Visualization is useful for:1. Data entry (initial conditions).2. Code debugging and performance analysis.3. Interpretation and display of results.• Our focus will be #3. The computational astrophysicist can either:1. Develop new visualization software tailored to problem under study.2. Use an existing software package.Plotting 1-D data• Function of o ne variable only: f(x) vs. x.• Examples: sm, gnuplot, xgobi, IDL, etc.• Minimum requirements:– Read data from file.– Perform arithmetic manipulation of data.– Multiple data sets on plot.– Multiple plots on page.– Add text to plots.Plotting 2-D data• Function of 2 variables, i.e. f(x, y).• If f is a scalar quantity, can:1. Make image.– Represent each (x, y) data point by one or more pixels on screen.– Use integer value to represent data value at (x, y) point (8 bit: 0–255; 24-bit:0–16.8 million).2. Make contour plot.– Contours are isosurfaces of data.3. Make 3-D surface plot.– Use (x, y) a s 2 coordinates, f as third coordinate, plot surface.1• If f is a vector quantity, i.e. f(x, y), can:1. Plot vectors directly (as arrows).– Can be hard to see.2. Plot streamlines.– Contours of Φ, where f = ∇Φ.• 2-D plotting packages include sm, gnuplot, xgobi, IDL, ximage, NCAR graphics, etc.Plotting 3-D data• Function of 3 variables, i.e. f(x, y, z).• If f is a scalar quantity, can:1. Plot 2-D slices.– E.g. faces of cube.2. Plot isosurfaces.– These are now 3-D surfaces. Can use wireframe of polygons. Can shade withsecond variable g(x, y, z).3. Plot volumetric rendering.– Solve transfer equation (“ray tracing”) using emissivity proportional to datavalue.• Standard algorithms exist for 3-D rendering, including shadowing, hidden surface re-moval, etc. Often implemented in hardware. Also have “dynamic/interactive” visual-ization: rotation, etc.• If f is a vector quantity, i.e. f(x, y, z), can:1. Plot 3-D vectors on 2-D slice.2. Plot streamlines in 3-D.• 3-D plotting packag es include tipsy, xgobi, IDL, NCAR graphics, xdataslice, etc.Animation• If any one of the coo r dinates of data in a plot is time, it makes sense to render imagesas a time sequence, e.g. make animation.• The eye is very sensitive to motion, can discover much detail using a nimations.• Animation formats include MPEG, FLI, QT, AVI, GIF, plus many custom formats.• Animation players include mpeg play, xanim, quicktime, gifview, etc.– Often built into web browsers.2Data Representation• Computers store data as different variable types, e.g. integer, floating point, complex,etc.• Different machines have different wordlengths, e.g. 4-byte ints on a 32-bit machine(Pentium), 8 -byte ints on a 64-bit machine (G5).• This makes ( binary) data non-portable.Integers• All data types represented by 0’s and 1’s.• An integer value:j =NXi=1si× 2N −i– N = # of bits in word.– si= value of bit i in binary string s .• E.g., 0 0 0 0 0 1 1 0 = 22+ 21= 6 for 8-bit word.• Use “two’s complement” method for sign (see below).• Largest value that can be represented is 2N− 1.• For 32-bit word this is 4,294,967,29 5.• Arithmetic with integers is exact, except:– when division results in remainder, or– result exceeds largest representa ble integer.E.g. 2 × 109+ 3 × 109= overflow error.• Note multiplication (division) by 2’s can be achieved by left-shift (right-shift), whichis very fast (in C, use the << (>>) operator).Two’s complement• Exploits finite size of data representatio ns (cyclic groups) and properties of binaryarithmetic.• To get negative of binary integer, invert all bits and add 1 to the result.E.g., 1 = 0 0 0 0 0 0 0 1 in 8-bit.invert bits: 1 1 1 1 1 1 1 0add 1: 0 0 0 0 0 0 0 1result: 1 1 1 1 1 1 1 1 = −1• In 8 bits, signed char ranges from −128 to +127.3Negative powers of 2• Binary notation can be extended to cover negative powers of 2, e.g. “ 110.101” is:1 × 22+ 1 × 21+ 1 × 2−1+ 1 × 2−3= 6.625.• Can represent real numbers by specifying some location in the word as the “binarypoint” (“fixed-point representation”).• In practice, use some bits for an exponent (“floating-point representation”).Floats• For most machines these days, real numbers are r epresented by floating-point format:x = s ×M × Be−Es = sign B = base (usually 2, sometimes 16)M = mantissa e = exponentE = bias, usually 127.• In past, manufacturers used different number of bits for each of M and e, resulting innon-portable code.• Currently, most manufacturers adopt IEEE standard:– s = first bit.– Next 8 bits are e. (e = 255 reserved for inf & NaN.)– Last 23 bits are M, expressed as a binary fraction, either 1.F, or, if e = 0, 0.F (inwhich case E = 126), where F is in base 2.E.g., 0 10000001 10100000000000000000000 = (+1)h2(129−127)i(1+ 0.5 +0.125) = 6.5.• Largest single-precision float fmax= 2127×(1+1/2+1/4+···+1/223) ≈ 3.4028235×1038(just under 2128).• Smallest (and least precise!) fmin= 2−149≈ 10−45.Round-off error• Not all values along real axis can be represented.• There are 1038integers between fminand fmax, but only 232≈ 109bit patterns.4• Values < |10−45| result in “underflow” error.• If value cannot be represented, next nearest value is produced. Difference betweendesired and actual value is called “ r ound-off error” (RE).• Smallest value emfor which 1 + em> 1 is called “machine accuracy,” typically 2−23∼10−7for 32 bits.• Double precision greatly reduces em(∼ 10−16). (In this case t he 64 bits are dividedinto 1 sign bit, 11 exponent bits, and 52 mantissa bits; the bias is 1023.)• RE accumulates in a calculation:– Random walk: tot al error√Nemafter N operations.– But alg orithms rarely random, giving linear error Nem.• Subtraction of two very nearly equal numbers can give rise to large RE.E.g., solution of quadratic equation...x =−b ±√b2− 4ac2a...can go badly wrong whenever ac  b2(Cf. PS#2).• RE cannot be avoided—it is a consequence of using a finite number of bits to representreal values.Truncation error• In practice, most numerical algorithms approximate desired solution with a finite num-ber of artithmetic operations, e.g.,– evaluating integral by quadrature;– summing series using finite number of terms.• Difference between true solution and numerical approximation to solution is


View Full Document

UMD ASTR 415 - Data Representation and Introduction to Visualization

Download Data Representation and Introduction to 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 Data Representation and Introduction to 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 Data Representation and Introduction to 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?