GalaxSee

Creating a Galaxy Text File

In order to allow maximum freedom in choosing initial conditions, GalaxSee allows the user to open any plain text file with the masses, positions, velocities, and even colors of individual stars. For example, a text file containing the following would be a valid galaxy:
2
200   1  1.5   2   0     0    0   1
1500 -1  2.1  .5   1     0    0   2
The first number specifies the number of stars. The next eight numbers describe the first star's properties. If the scale is set to galactic, the computer will understand this to be a star of 200 solar masses, with x-coordinate 1 kly (kilo-light year), y-coordinate 1.5 kly, z-coordinate 2 kly, moving at 0 ly/Myear in the x-direction, 0 ly/Myear in the y-direction, and 0 ly/Myear in the z-direction. It is colored color number 1, which is red (the colors are numberered in the order in which they appear in the View menu under Star Color--1 is red, 2 is green, 3 is blue, 4 is yellow, 5 is purple, 6 is cyan, 7 is white). Similarly, the second star would a mass of 1500 solar masses, is at the loaction (-1,2.1,.5) kly, and is moving at a speed of 1 ly/Myear in the x direction, and is colored green. Note that if the scale was set to Solar System, the interpretation of these numbers would be different--for example, the distances would be in astronomical units (the distance of the earth from the sun) rather than in kilo light years.

More complex systems

It would probably be tedious to type in the individual information for each of 500 stars or so. However, the fact that any text file with the numbers in the right order will work means that, for example, a galaxy could be generated with a spreadsheet, or from the output of a Matlab program, or any of a wide variety of other possibilities. For example, it is fairly simple to get Excel to generate a 500 star galaxy with a random distribution of masses, velocities, etc.

Things to keep in mind

Creating a text file to be read into GalaxSee is somewhat like writing a computer program. If you put garbage in, GalaxSee is likely to spit garbage back out. It is a good idea to check that, for example, the first number is actually the number of stars and that there are eight numbers for each star. As far as GalaxSee is concerned, the above galaxy could be put in as a single line:
2 200 1 1.5 2 0 0 0 1 1500 -1 2.1 .5 1 0 0 2
but it would be easy to make mistake the above for
2 200 1 1.5 2 0 0 1 1500 -1 2.1 .5 1 0 0 2
which is missing a number. This will result in unpredictable behavior if it is opened in GalaxSee . Thus, it is useful to keep things line up in rows and columns so that omissions will be obvious.

Another thing to keep in mind is that GalaxSee displays the stars in a cube, the size of which is visible in the Info Window. It will perform calculations on stars outside the viewing area (as long as there is at least one visible), but you won't be able to see them unless they move into (or near) that box.

As implied above, there are no units stored in the galaxy files. GalaxSee assigns units to the numbers according to the current setting of scale. Any valid galaxy can run in any scale setting, but the results can (and generally will) be vastly different.

GalaxSee accepts scientific notation (like 1e+2 for 100, etc).

Go to the Help Index.

Some Examples

The galaxy "green_yellow.gal" is a galaxy that was first generated by GalaxSee , then opened with a spreadsheet program and altered. (This is the recommended way to create your own galaxy, especially for your first time.) Using functions available in the spreadsheet, the colors of the stars were changed so that all of the stars with positive values for their z-position were colored green, and those with negative values were colored yellow. The galaxy was then saved as tab-delimited text (an option that the spreadsheet program allowed) and re-opened in galaxy.

The galaxy "random_vel.gal" was created in a similar way, except that in this instance, the colors were left alone and the spreadsheet's random number function was used to produce random numbers in the range (-2.5 , 2.5) for the velocity components.

It is also possible to start from scratch in the spreadsheet, but it's easier to be sure the format is right if you first generate a galaxy of the appropriate size and save it, then alter it with a text editor or spreadsheet program.

It is also possible to write a simple computer program to generate various galaxies and save them as text files.


[ Home | GalaxSee Home | Index ]
[ Introduction | Instructional Resources | Simulation Software | GalaxSee Help ]
[ Fractal Modeling Tools | Bareroceptor Modeling | SimSurface | Gnuplot ]
[ The Pit and the Pendulum | Environmental Models | InteGreat ]

Last Update: June 20, 1997
Please direct questions and comments about this page to WebMaster@shodor.org
© Copyright 1997 The Shodor Education Foundation, Inc.