24
(Almost) Everything you wanted to know about S2PLO T... 1 (Almost) Everything you wanted to know about using S2PLOT to visualise astronomy datasets... Workshop CRICOS provider 00111D Christopher Fluke & David Barnes “Those not properly initiated into the mysteries of visualisation research often seek to understand the images rather than appreciate their beauty...”

(Almost) Everything you wanted to know about S2PLOT... 1 (Almost) Everything you wanted to know about using S2PLOT to visualise astronomy datasets...Workshop

  • View
    242

  • Download
    1

Embed Size (px)

Citation preview

(Almost) Everything you wanted to know about S2PLOT... 1

(Almost) Everything you wanted to know about using S2PLOT to visualise astronomy datasets...Workshop CRICOS provider 00111D

Christopher Fluke

& David Barnes

“Those not properly initiated into the mysteries of visualisation research often seek to understand the images rather than appreciate their

beauty...” Al Globus & Eric Raible (1994)

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 2

Overview

In this session, you will receive a hands-on introduction to S2PLOT programming. This will include the basics of an S2PLOT program, the standard graphics primitives, and how to create more complex applications using the power of the S2PLOT callback system.

Disclaimer: I am a C-programmer (and a vi user) and my bias is shown in the examples.

S2PLOT is also available for FORTRAN and Python.

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 3

Outline• Discuss some of your 3-d data • Get s2plot running on your laptop• Try out some of the basic functions• Change parameters

• Look at callbacks• Handles• Isosurfaces• Volume rendering

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 4

Brunner et al. (2001):• Imaging data: 2D, narrow , fixed epoch• Catalogs: secondary parameters determined from processing

(coordinates, fluxes, sizes, etc). • Spectroscopic data and products (e.g. redshifts, chemical

composition).• Studies in the time domain - moving objects, variable and

transient sources (synoptic surveys) • Numerical simulations from theory

Astronomical Data

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 5

What is your data like?

Discuss...

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 6

Get s2plot running on your laptop

Instructions at:http://astronomy.swin.edu.au/s2plotor (Mac OS X Leopard)

http://www.physics.umanitoba.ca/~english/vizATNF/s2plotSetup_cf.txt

Download sample code: gunzip ATNF_3DWorkshop.tar.gz tar -xvf ATNF_3DWorkshop.tar cd ATNF_3DWorkshop

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 7

Basic functionality

Try out some of the basic functions. Either:1. Get sample code from function reference at

http://astronomy.swin.edu.au/s2plot or 2. Copy from ${S2PATH}/functions

cbuild.csh <code>

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 8

Initialise

Create geometry lists

Register Callback Functions

GLUTMAINLOOP

Handle Window Events

Handle User Events

Call Callbacks

Draw Geometry using OpenGL lists

S2PLOT Program Flow

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 9

#include <stdio.h>#include <stdlib.h>

int main(int argc, char *argv[]){ int I, N; N = 20; for (I=0;I<N;I++) { if (I != 4) { printf(“hello world %d\n”, I); } else { printf(“time for a change?\n”); } } return 1;}

Header files

All programs must have a main function

Declare variables

Assignment

LoopingLogical Tests

Output to terminal

{ } pairs - control structures

(Most) Commands end with semi-colon ;

For those of you who are not C-programmers...

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 10

Building S2PLOT code

cp src/s2hello.c . [EDIT] s2hello.c cbuild.csh s2hello ./s2hello

When prompted for a Graphics device type, hit <enter>Not very exciting is it? :)

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 11

Example

1. Try changing the values of xmin,xmax etc.2. Try changing the values of x, y, z3. Try changing the value of ptype4. See if you can add some more points at random

locations in the box

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 12

Example: geometry

cp src/s2geometry.c . cbuild.csh s2geometry ./s2geometry [EDIT] s2geometry.c

For more geometry, seehttp://astronomy.swin.edu.au/s2plot

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 13

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 14

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 15

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 16

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 17

Plotting transmission curves

cp src/filters1.c .cbuild.csh filters1.c./filters1[EDIT] filters1.c

Notice anything wrong?

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 18

cp src/filters2.c .cbuild.csh filters2.c./filters2[EDIT] filters2.c

TASK: Draw line segments rather than pointsTASK: Try and add some more labels

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 19

cp src/landolt1.c .cbuild.csh landolt1.c./landolt1[EDIT] landolt1.c

TASK: Experiment with changing the parameters that are plotted.

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 20

cp src/landolt2.c . cbuild.csh landolt2.c ./landolt2 [EDIT] landolt2.c

TASK: Make the points a bit thicker

Wouldn’t it be nice to know more about those outliers?

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 21

Dynamic geometry via callbacks

cp src/landolt3.c . cbuild.csh landolt3.c ./landolt3 [EDIT] landolt3.c

Use Shift-S to toggle handlesUse Shift-C to display cross-hairsDe/Select with right mouse button

TASK: Replace s2textxy strings with billboard text

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 22

Isosurfaces & Volume Renderingcp src/volumes.c .cbuild.csh volumes./volumes[EDIT] volumes

Press <space> to switch between:• Points only• Volume render• Isosurface

TASK: Edit volumes.c and change slope, level and colour map (s2icm).

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 23

The Next Step

Now that you’ve had a chance to experiment with the basics of S2PLOT, let’s talk about your 3-d visualization needs...

Visualizaton at ATNF 2009 (Almost) Everything you wanted to know about S2PLOT... 24

Me: [email protected] Web-site: http://astronomy.swin.edu.au/s2plot Google Group: http://groups.google.com/group/s2plot

Please send me your images for the gallery:http://astronomy.swin.edu.au/s2plot/index.php?title=S2PLOT:Gallery

If you use S2PLOT to help your research, we would appreciate the following acknowledgement in your paper(s):Three-dimensional visualisation was conducted with the S2PLOT progamming library

and a reference to

D.G.Barnes, C.J.Fluke, P.D.Bourke & O.T.Parry, 2006, Publications of the Astronomical Society of Australia, 23(2), 82-93.