Using JSkyCalc
John Thorstensen, Dartmouth College; 2007 January; rev. 2013 February

What is this for?

JSkyCalc is a tool designed to help you plan and execute astronomical observations. It shares some features with "desktop planetarium" programs such as XEphem and its many commercial alternatives, but rather than elegant visual presentation, the program emphasizes convenient controls and calculation of the quantities of greatest interest to professional astronomers.

Getting Started

The control buttons at the bottom of the frame do the following; more detailed descriptions of some of the windows they pop can be found a little further down:

  • Refresh Output reads all the input values, computes everything, and refreshes all the output. The input values are overwritten with the values that the program used, and the the day of week is appended to the date.
  • Set to now sets the program time using your computer's clock, and refreshes the output. Step Forward and Step Back step the time forward or back using the value of the timestep (explained above).
  • Auto Update keeps the program close to real time -- it sets everything using Java's clock time (which is UT), sleeps for the number of seconds indicated in the sleep for (s) field, and then wakes up and updates again. Auto Step steps forward by the timestep, sleeps for the desired number of seconds, and then repeats. The sleep for field accepts only integers.
  • The Site Menu (which is displayed on startup) allows you to select among many of the world's major observatories. Changing sites causes the computations to be refreshed; the Universal time is kept the same, so the local time will jump if the offset from UT is different. If the desired site is not on the list you must enter its parameters in the fields in the main window, but you must first click the button on the site menu to Enable User Input. The DST code parameter is used to select the convention used for Daylight Savings time (if any). The US convention is 1 (but Arizona and Hawaii do not observe DST); negative numbers are used for southern hemisphere sites. [If you're using the program with WebStart, you're stuck with either using the pre-programmed menu choices or entering your own site's parameters every time; if you install the program locally, just find the file "skycalcsites.dat" and install your own site following the format explained there. The file "skycalcsites.orig" should be left untouched for use in case you inadvertently corrup "skycalcsites.dat". The skycalcsites.dat file must be kept in the same directory as the class files.]
  • The Planet Table gives low-precision positions of the planets (to about 1 arcmin for the inner planets, and several arcmin for the outer ones), in the epoch of date. The last column in the table, Proximity, gives the angular distance between the planet and the coordinates that are used in the main program.
  • Hourly Circumstances summarizes the observability of your object through the night. If the time is before local noon, the previous night is tabulated. This is among the most heavily used features..
  • The Nightly Almanac lists the times of sunset and sunrise, twilight, and moonset and moonrise, corrected for the Terrain elevation (of the observatory above its surroundings). The terrain elevation must be a positive number (this is checked on input and reset to zero if negative).
  • Seasonal Observability presents a table summarizing the observability of the object at each new moon and each full moon over a span of about 6 months centered on the program date.
  • Object lists ... lets you read in a list of your own objects, which you can then select from a menu or call by name from the Object field in the main window. They also appear on the Sky display, and you can select them there with a left mouse click. The Object List feature is extremely useful, but security features of WebStart prevent loading of object lists, so you need to install the program locally to make it work; fortunately, this is very straightforward.
  • The Sky Display gives a schematic view of the sky, with stars to V = 4.5 , the planets, the sun, the moon, and any objects loaded in the list indicated. You can control some things from the display window with mouse and keyboard commands -- holding down the right mouse button in the sky display gives a brief menu.
  • The Alt. Coordinates window gives the input coordinates precessed to the present equinox, the Galactic coordinates, the ecliptic coordinates, and the parallax factors. If you type Enter in the Galactic coordinate field, the position in the main program is set to the galactic coordinates you give, that is, the program converts from galactic back to equatorial. The parallax factors are the eastward and northward angular displacements, in arcsec, for a star with a parallax of 1 arcsec, at this celestial location and at this time. The displacements suffered by a real star can be found by multiplying these factors by its parallax (measured in arcseconds).
  • The Airmass Graphs window creates a display of airmass vs. time through the night. Local time is plotted at the bottom of the frame, and UT at the top. Airmass is plotted vertically, with low airmass (small zenith distance) at the top. The altitude of the moon above the horizon, is plotted in yellow, with little symbols indicating the phase. This is keyed to the yellow scale at the right-hand side of the plot (not the same vertical used for the airmass). A few non-obvious features of this tool:
  • The Parallactic... button opens a window that computes the optimal rotator setting for an observation that will begin shortly after the time depicted in the main window. This is of interest mostly to long-slit spectroscopists who are not using atmospheric dispersion correctors; more detail is given below.

    More detail on the Output Parameters

    The output parameters on the right-hand side of the window are:

    More Detail on the Other Windows

    Except for the Site Menu and Sky Display window, these other windows are all hidden on startup. You can get the windows to show using the buttons at the bottom of the main panel -- the buttons toggle the corresponding window on and off. Most of the windows also have their own "hide" buttons. Don't use your windowing system's buttons to close windows, as this can kill processes.

    The Hourly Circumstances window is a popular favorite. It gives the circumstances for the object coordinates (from the main window), computed for each hour through the night. Time is given in Local, UT, and sidereal (LST), followed by the hour angle and airmass, followed by the altitude of the moon and the sun. Warning colors (red, orange, yellow, light purple, and blue) are used in the HA, airmass, moonalt, and sunalt columns. If the time in the main window is before noon, the previous night is shown; if the time is after noon, the coming night is shown. This is so that if you run a calculation with the time set to 2 AM, it computes the table for the most appropriate night.

    The refresh time for this window can be noticeable; if you're not using the output, you can hide it using the button provided, which turns off the refresh and can speed things up a bit. You can put the window back up using the button in the main window.

    A button is provided to dump the contents of this window to a file in your local directory. The output is appended to the file, so you can run a number of objects and then print the file.

    The Nightly Almanac window gives times of sunset, sunrise, twilight (when the sun is 18 degrees below the horizon), moonrise, and moonset, defined as when the upper limb is on the visible horizon. When the terrain elevation is zero (this quantity is defined here as the elevation of the observatory above the terrain that forms its horizon), the rise and set times are computed for when the center of the sun or moon is 90 degrees, 50 minutes from the zenith, which accounts roughly for atmospheric refraction and the angular size. If the terrain elevation is greater than zero, the rise and set times are adjusted accordingly. The sidereal times at evening and morning 18-degree twilight are also listed.

    If the time in the main program is before local noon, the previous night is computed. If it's after local noon, the next night is computed. This is just like the Hourly Circumstances window. The window is invisible on startup, but can be revealed or hidden using the buttons provided.

    The Planet Table gives low-precision coordinates of the planets, derived from algorithms given by Jean Meeus in Astronomical Formulae for Calculators (Willman-Bell). The inner planets are good to about a minute of arc, but the outer planets are somewhat worse, and Pluto (I know, it's not a planet any more officially) is pretty bad. Coordinates are in the epoch of date. (These planetary positions are also used internally to find the offset between the heliocenter and the barycenter for the barycentric corrections.) The last column in the table, Proximity, gives the angular distance between the planet and the coordinates that are used in the main window. The planet table can be printed using the built-in print method provided by Java for this class.

    The Object List window lets you read in a list of astronomical objects. Reading in a list of objects read in greatly enhances the usability and power of the program -- you don't have to type in coordinates, and the objects are graphed on the Sky Display. The list must be in this format:

         name_no_blanks   hh mm ss   dd mm ss   equinox  [optional web address]
    
    for example,
         4U1234+56   12 34 35.3  56 01 02   1950   file:///home/thorstensen/charts/4u1234.jpg
    
    The format is dictated by the telescope pointing list format expected at MDM Observatory, where I do most of my observing. [Note to MDM observers: The telescope control system may choke on the optional web address.] Colons are acceptable as delimiters for the RA and dec fields (but be advised, again, that they don't work with the MDM telescope software). The Load New Object List button pops a file-selecting dialog box. Once you've loaded up a list, you can click on the object you want, and it will be loaded into the program. If you prefer, you can also select an object by typing its exact name into the Object: field in the main window and pressing the Enter key. You can present the list in either RA or alphabetical order using the buttons provided, and the Clear List button deletes all the objects (but for technical reasons, a single object called null at zero hours and zero degrees will remain). A hide button is provided also.

    You'll notice that once you've loaded a list, its name appears in a second little selector box in the window. This makes it easy to recall the contents of the list without the tedium of going through the file-selection popup. So, you can have several different lists, say for different categories of objects or different programs, and quickly swap between them. Just click on Clear List to get rid of the old objects, select the previously loaded list in the box, and presto, you've switched lists. Beware that strange behavior may result if you have two lists loaded at once, and they have objects in common.

    What's with that web address? If, when the list is loaded, there is an extra field with either "file" or "http" in it, this extra field will be loaded as a web address associated with the object. Note tha this can be a file on your own system as in the example above. If you select this object, it's web address appears at the bottom of the main window; pressing the Send button will send this to your desktop for appropriate action, such as loading to a browser, or popping an image file in a viewer, or opening the file in a PDF reader. This lets you link in whatever other information about the object you'd like to have available quickly -- a finding chart, notes on how to observe it, notes on the science you're trying to accomplish or the observing conditions -- whatever!

    The Alternate Coordinates window gives the coordinates precessed to the equinox of date, the galactic coordinates, (which are rigorously accurate), and ecliptic coordinates. There's no hide button -- use the button on the main window to toggle the window on and off.

    The white background behind the galactic coordinates signifies that they can be used for input. Entering a value in the galactic latitude or longitude fields and pressing Enter sets the coordinates in the main window to the location specified by the longitude and latitude you entered. Thus the program can serve as a galactic-to-equatorial converter. I have not implemented an analagous function for ecliptic coordinates.

    The Seasonal Observability window is useful for planning when to observe an object (for example, in filling out a time request form). It takes the date from the main window, figures out when new and full moons will occur for about three months on either side, and generates a table, each line of which gives a brief summary of the object's observability at each of these dates. The hour angle and airmass are given at the start of the night, the natural center of the night, and the end of the night. The last three columns give the number of hours that the object is accessible without twilight and at airmasses of less than 3, less than 2, and less than 1.5. A button is provided to print the output.

    The Parallactic... window is a tool that computes where to set an instrument rotator for an upcoming observation. Because air is dispersive (i.e., its index of refraction varies with wavelength), an object observed away from the zenith will be smeared into a small spectrum, with the violet end closer to the zenith than the red end. If you're using a long-slit spectrograph, you can capture the whole spectrum by aligning the slit with the parallactic angle, which is the angle between (a) a great circle arc toward the pole, and (b) a great circle arc toward the zenith, measured north through east. The parallactic angle is, crudely, the "position angle of straight up". The tool provided here computes the refraction-weighted average parallactic angle -- which is the optimal angle for the slit -- for your target for a specified upcoming time interval. To use it,

    The computed optimal angle appears in the appropriate box.

    Note that for any given instrumental setup, the rotator setting may not correspond directly to the projected position angle of the slit. This is not an issue with the MDM 2.4m with default north-south slits -- the slit angle is simply the same as the rotator.

    The graph shows the Cross-slit refraction factor as a function of time during the anticipated exposure, for the optimal angle (in white) and some other rotations of the instrument. The quantity graphed is

    Cross slit factor =  tan[zenith distance] * sin[rotator angle - optimal angle].
    
    This goes to zero when the rotator is aligned with the parallactic angle; departures from zero indicate misalignment. Because refraction is proportional to tan(z), the magnitude of the factor quantifies the 'badness' of a given alignment.

    The magenta and cyan curves that flank the optimal white curve show results for angles at 15-degree intervals away from optimal. This shows how critical the rotation setting is (near the zenith, it doesn't matter, but it matters a lot at high airmass). In addition, the red curve shows the result for the rotator setting you specify in the Current Rotator box. This is handy if you're already set up at some angle and want to see if you can get away with not rotating the instrument for the next target.

    How stringent do you need to be? That depends on a host of factors; how big your slit is, your spectral range (refraction is almost constant across a narrow wavelength range), the seeing, your scientific goals, and so on. Alex Filippenko ( 1982PASP...94..715F ) has a complete discussion. For a 1-arcsecond slit with a wide passband (4000-7500 Angstroms), a good rule might be to keep the factor less than 1.

    The parallactic window background is black at night and fades into blue during twilight; this should alert you if a planned exposure will extend into twilight (note that astronomical twilight is defined very stringently, so that some twilight is usually tolerable). In addition, the airmass at the start and end of the specified interval is displayed, using the same warning color scheme as in the main window.

    The Sky Display Window

    The Sky Display button in the main window toggles the display on and off (it does take a lot of screen real estate). The window plots a map of the sky, showing stars to V = 4.5, the sun, moon, and the planets (including Pluto, whatever you want to call it). If you have an object list loaded, it also plots each object as a text string, the bottom of which is centered on the object. The coordinates in the main program are marked with a greenish box. The stars are generally not plotted in a pure white, but with a color derived from the spectral type; the RGB values chosen to represent the spectral types are based on those computed by M. N. Charity (see http://www.vendian.org/mncharity/dir3/starcolor/). I de-saturated his suggested colors slightly (moved them toward white) because the full colors were a bit distracting.

    Red arcs indicate the meridian, the equator, and lines of constant hour angle every 2 h out to +- 6 h. Dotted red circles indicate 2, 3, and 4 airmasses.

    The moon is drawn at exaggerated size but in the correct phase and orientation. The planets are sized according to magnitude, with the fainter ones rendered as very small dots. A clock drawn in the upper right corner shows the prevailing local time; the Site and Universal Time information are printed at the lower right. The background color is controlled by where the sun is -- when there is no twilight the background is black (even if the moon is bright). There's a small, discontinous jump to dark grey at the beginning and end of twilight, and a continuous ramp between twilight and daylight, which is rendered in blue. This proves very helpful in keeping the user oriented in time.

    The sky display updates whenever the main window changes, so the Auto Step command results in a somewhat jerky animation.

    The sky display recognizes several mouse and keyboard commands , as follows. But first, note that the window will not respond to the keyboard commands unless it has focus (with most systems, this is indicated by some kind of change in the window border). The mouse commands work regardless (though I have heard of people having issues with these features on Macs running OS-X).

    It's a minor detail, but the stars are precessed to the current equinox whenever their coordinates are more than one year out of date; they are not precessed with every refresh to save computation time. One notices this with the 'h' command - the coordinates loaded will be close to the equinox of date, rather than (say) J2000. The planets, sun, and moon are already in the equinox of date. The object list is precessed with every refresh.

    Bugs, "Gotchas", and Limitations

    This is surely an incomplete list:

    About the Program

    This program is a re-implementation in Java of the venerable skycalc code, which is a text-only program written entirely in C. Around 2005 I wrote a graphical user interface for skycalc by wrapping the C routines in Python and implementing the user interface with Python's Tkinter module, and I wrote a sky display similar to the one used here. This proved extremely useful, but the software dependencies complicate installation, so I re-wrote the software in Java. Much of the "guts" are taken line-by-line from earlier versions, but the object orientation in the Java code is designed more logically than in the python versions.

    Accuracy. A rough extrapolation of delta-T is used for the time argument of the lunar and solar calculations. The sun should be good to 1 arcsecond or so, the moon to a few arcseconds. Comparison with the JPL ephemerides shows that the barycentric corrections are good to a few meters per second in velocity and a few hundredths of a second in time. The precession routine used conforms to the IAU 1976 resolutions, and is not as rigorous as the 2000 conventions; the penalty in accuracy is of order 0.1 arcsecond. As noted above, the planetary ephemerides are only accurate enough for rough purposes. The text-based Skycalc program has an extensive manual describing the algorithms used; the present Java code uses the same algorithms (and gives identical results as far as I have been able to test).

    Legalities. I am offering this program freely but claim copyright. Anyone may copy and modify the code, provided that the credit banner with my name and institutional affiliation is not altered. Although I have been careful to ensure that the code is correct, I make no claim that it will always be correct or sufficiently accurate. I also make no claim that it will be suitable for your application. This code should never be relied for applications in which personal safety might be an issue, and it should not be considered authoritative for legal purposes.

    I will not be able to answer all queries, but if you believe there is a bug, or have a suggestion for an improvement, or just want to comment, please do email me (john dot thorstensen at dartmouth dot edu).