# Artificial sky

An overview of an artificial sky modelling.

## Purpose

The tool `artificial` creates artificial frames which looks like frames acquired by a real telescope. The primary purpose of this tool is to test, and to verify, algorithms of Munipack. However, it can be very useful for both education and planing of an observation ‒ some atmospheric and instrumental effects, as well as some sky phenomena, can be easy modelled.

## Brand icon

All generated frames are marked by a brand icon. The icon is supposed as the very important element, because the artificial frames can look very realistic for inexperienced peoples. In many situations, it can be very difficult to recognise, even by an objective method, between a real and the artificial frame. That why there is no way how to remove the icon except the source code modification.

The brand icon

FITS headers of all files contains review of parameters used for frame generation. It naturally indicates the right origin of any frame without doubts. However, frames are sometimes converted to other picture formats such as PNG or JPG, or examined by non-expers, so the clearly visible watermark is the proper warning marker.

## The very first simulation

For our very first generated frame, we'll select the open star cluster NGC 637 (see A Star Chart Tutorial). The artificial frame can be generated by these commands:

    $ munipack cone -o ngc637.fits -r 0.1 -- 25.775 64.03
    $ munipack artificial -c ngc637.fits --rcen 25.775 --dcen 64.03 --verbose

The result is available as `artificial.fits` and displayed on figure below. Many parameters has been keep on their default values as `--verbose` switch shows. The most important parameters are the telescope area 1m2 (cca 1.1m in diameter by default) and the exposure duration 1 second. The stars on the frame has been given by a catalogue (in this case UCAC4) so a real exposure can provide more deeper look.

Artificial frame of NGC 637

Size of the generated picture, field of view (or scale) and rotation can be adjusted. Results can be saved to a named file. The following example creates a mini picture with dimensions in golden ratio, which is rotated around center with 180° angle and stored in `ngc637_mini.fits` file.

    $ munipack artificial -c ngc637.fits --rcen 25.775 --dcen 64.03 --verbose \
                          --width 168 --height 100 --fov 0.2 --angle 180 \
                          --mask ngc637_mini.fits

Miniature of NGC 637

## Observation planning

Artificial frames can be useful in preparing of plans of an observation. The observer's proper choice of the exposure time for an unknown object significantly increase both reliability and precision of results. The matter can be generalised also on an unknown telescope, actual observing conditions, detectors. All the conditions can be adjusted "on the run", but this tool can help to save costly observing time.

All the detector and telescope parameters can be set with `--exptime, --diameter (--area), --qeff` options. Their impact, using common values, in case of the field of blazar 0716+71 displays the figure. The blazar itself is at centre of the picture on pixel coordinates 256, 192.

    $ munipack cone -r 0.3 -- 110.473 71.343
    $ munipack artificial --qeff 0.02 --exptime 120 --area 0.3 \
                          -c cone.fits --rcen 110.473 --dcen 71.343 --fov 0.3 \
                          --width 512 --height 384 --col-mag Vmag

Artificial frame of 0716+71

Keep in mind, the frames with different parameters can looks identical due auto-adjusting capabilities of FITS viewers. Observed frames taken at longer exposures will reveal more faint stars, which are not included in common catalogues, due to its limitations. To be sure, while playing with artificial sky, inspect values of single pixels inside stars, that simulated counts are proportional to the parameters.

The quantum efficiency (`--qeff`) of a telescope includes products of all individual efficiencies in given spectral band of detector (CCD), filter, telescope (and possibly other optical elements down to optical path). They can be estimated from a calibrated observed frame by CTPH keyword as r (see). The frame should be take near zenith. Assuming of an extinction in the given filter on k (typical values are 0.05 for Johnson R and 0.3 for Johnson B filters), the efficiency is η = 1/r - k. The typical values η lies inside interval from 0.05 (bad) to 0.5 (very good).

Range checking The visual inspection of peak value of the blazar gives 4300 counts above background (peak at 5300, background one thousand). The value is pretty acceptable. The peak value is within expected dynamical range (65 thousands), if a 16-bit CCD detector is expected.

Result Precision More detailed analysis can be performed with help of the complete photometry calibration:

    $ munipack find artificial.fits
    $ munipack aphot artificial.fits
    $ munipack phcal -c cone.fits --photsys-ref Johnson --area 0.3 \
                     -f V --col-mag Vmag --col-magerr e_Vmag artificial.fits

The result in `artificial_cal.fits` gives for magnitude of the blazar 14.23 ± 0.01 with good agreement with catalogue value 14.2 ± 0.4 (note use of parameter `--col-mag` which is important here). The error due to photon noise is relative high and longer exposure duration can be recommend. Moreover, the used quantum efficiency only 2% (!) is extremely low and an technical improvement in apparatus can be recommended.

## Atmospheric effects modelling

Light rays passing Earth's atmosphere are scattered, reflected and attenuated proportionally to the length its path in the atmosphere. The atmosphere related effects, which are modelled, includes both atmospheric extinction and seeing and sky background dependence. The atmospheric refraction is excluded.

The effects are considered just if `--atmosphere` switch is presented. Only the extinction parameter (`--extk`) can be adjusted (see manual page). The proper set up of observation station and time (`--long, --lat, --date, --time` ) is necessary.

To show the capability, we will prepare of a sequence of seven frames, each 1 s, separated by one hour interval which demonstrate atmospheric effects on BL Lac blazar field during its down somewhere in central Europe. The figure below shows two selected output frames.

    $ munipack cone -r 0.2 -- 330.68 42.27
    $ munipack artificial --verbose --fov 0.3 -c cone.fits --rcen 330.68 --dcen 42.27 \
                          --mask 'art_?.fits' --lat 50 --long 15 --date 2016-08-29 \
                          --time 00:00:00.000 --count 7 --timestep 3600 --exptime 1 \
                          --atmosphere --extk 0.1 --width 315 --height 510

BL Lac field near zenith
BL Lac field 20° above horizon

The actual value of the radius of seeing core is determined from `--hwhm` option. The radius represents spreading of a star image by turbulent motions in Earth atmosphere. The turbulence is very unpredictable. The fact is known to observers at moments when "focusing is impossible". It also confirms the experience that the best focusing is nearly to zenith.

## Light curves

Light curves extracted from generated frames can be used for training purposes as well as testing of various processing algorithms.

There are more ways to specify a light curve. We will select the most common way. The light curve pattern can be included in a table with twines: time, magnitude (detailed description by Times series document). The table is used to create a required light curve. Points located out of tabulated values are interpolated by smooth spline.

As the model data, I selected a light curve extracted from article New planet -- Kepler-21b -- discovered (physrev.org). The weighted original data (the plus or star symbol in blue by the paper) are used but I changed significantly the deep of the occultation. Therefore only the shape of light curve is similar to original. Everything else is my personal choice (period,...).

The first step is preparation of the data to form (FITS file) required by the utility. The easy way is modification of Kepler-21b.lst file:

    0 1.00714
    0.0245776 1.00714
    0.0506912 0.953571
    0.0768049 1.03393
    ....

The data can be replaced any another set. The number of rows must corresponds with NAXIS2 keyword. When the file is prepared, create FITS table (note that FITS table can be also created by any other way):

    $ munipack fits --restore Kepler-21b.lst

No catalogue is used here with contrast to previous examples of modelling. The background field stars are random in both positions and brightness. The picture looks artificially because stars are limited by 13 magnitude. The frame is not the actual field of Kepler 21b in any case!

Light curve related parameters starts with `--lc-` and defines equatorial coordinates `--lc-ra, --lc-dec` of a variable object (there exactly in the centre of frame), magnitude `--lc-mag` and the light elements `--lc-jd0, --lc-per` (the created sequence of frames covers the full period).

    $ munipack artificial --verbose --mask 'art_??.fits' --fov 0.3 --rcen 150 --dcen 50 \
             --date 2017-07-14 --time 00:00:00 --count 48 --timestep 180 --exptime 60 \
      	 --lc-table Kepler-21b.fits --lc-mag 12 --lc-jd0 2457948.5 --lc-per 0.1 \
             --lc-ra 150 --lc-dec 50

Artificial frame of Kepler-21b.

The artificial frames can be processed by the same way how frames which has been taken on the real sky. The processing skips photometric corrections (like bias frames) and the astrometry calibration which is already included. There is no photometry catalogue, so I referenced all frames against the first (by random choice) frame in sequence. There are the processing steps:

    $ munipack find art_??.fits
    $ munipack aphot art_??.fits
    $ munipack phcal -C 1 --photsys-ref Johnson -f V -O --mask '\!\1_man.\2' art_01.fits
    $ ls art_??.fits | xargs -L 1 munipack phcal --photsys-ref Johnson -f V -r art_01_man.fits
    $ munipack timeseries -l MAG,MAGERR --stdout -c 150,50 art_*_cal.fits > Kepler-21b.lc

The artificial light curve and the model of Kepler-21b.

The graph shows small visible offset between model and data curve. The slight difference due to some improper normalisation in model data is a potential trap.

Tip. It is very instructive to play with shorter or longer exposures to discover a noise contribution.

## Elliptical galaxies

A photometry on a galaxy background is common for distant supernovae and similar sources. The artificial framework has implemented a rough model for elliptical galaxies profiles.

There is a complex example for field of M 59 (a member of Virgo galaxy cluster). Three galaxies are modelled; their parameters are passed via a catalogue.

    $ RAJ2000=190.5097
    $ DEJ2000=11.6469
    $ munipack cone -r 0.2 -- $RAJ2000 $DEJ2000
    $ munipack fits --verbose --restore artgalaxy.lst
    $ munipack artificial --exptime 10 -c cone.fits --galcat artgalaxy.fits \
    	 --rcen $RAJ2000 --dcen $DEJ2000 --fov 0.19 \
             --width 900 --height 900 --hwhm 1 --psf MOFFAT

The artificial image of close neighbourhood of elliptical galaxy M 59 as seen by an ideal telescope having its area 1m2 after exposure 10 seconds (as displayed by logistics ITT function).

Tip. Compare the frame with the image M 59 archived by Digital Sky Survey.

## See also

Manuals: Artificial frames. Artificial Sky … (seminary talk)