Skip to content

panoptes/panoptes-timegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

panoptes-timegen

About the Timelapse Generator

The Timelapse Generator is capable of outputting Full HD video (1920 x 1080) or the original frame size (5208 x 3476) to an mp4 video file. The codec fourcc tags used are avc1 and mp4v. The first choice is avc1 and on failing to use this mp4v is used.

The Timelapse generator takes a directory containing FITS files, either *.fits or *.fz. Please take care to avoid putting *.fz and their decompressed *.fits in the same directory to avoid duplicates in the video as the script doesn't differentiate between them.

Each FITS file from Project PANOPTES is usually of size (5208 x 3476) and is usally single channel. The timelapse generator takes these type of files, and applies the following operations on them:

  • Debayering to get RGB image. Bayer patter used: 'RGGB'. Remember that astronomy format is to save zeroth pixel at bottom left corner of the image array
  • Stretching to modify the contrast of the image.
  • Sub-image extraction to get only a part of an image. Note that the script rotates any sub-image to ensure that the video is always in landscape mode.
  • Saving the sub-images in .jpg format to a directory called temp_timelapse in the same directory as the time_gen.py script.
  • Generating the video file from the .jpg files stored in the temp_timelapse directory.

After successful generation of the video file, the temp_timelapse directory is cleared.

Setting up the environment

Windows (Tested on Windows 10)

Download and extract the github repository. Say its at \panoptes-timegen-master. Open a new CMD window as administrator and do the following:

Make sure you already have python 3 installed and accessible from the command line as python.

  • Step 1 :

    • In the shell, run pip3 install venv
    • python -m venv pan-tg This results in a new python virtual environment named pan-tg at \panoptes-timegen-master\pan-tg
  • Step 2:

    • Activate the virtual environment by running the shell command: pan-tg\Scripts\activate from the panoptes-timegen-master directory.
    • Install the required python packages by running pip3 install -r requirements.txt after activating the virtual environment

Linux (Tested on Ubuntu 18.04)

Download and extract the github repository. Say its at /panoptes-timegen-master. Open a new terminal and navigate to this directory.

If you already have pip3 and venv installed, skip Step 1.

  • Step 1 : In the terminal do:

    • $ sudo add-apt-repository universe
    • $ sudo apt-get install python3-pip python3-venv
  • Step 2 : Now start installing the required python packages by activating the virtual environment.

    • $ python3 -m venv pan-tg
    • $ source pan-tg/bin/activate
    • (pan-tg) $ pip3 install -r requirements.txt

Here pan-tg refers to the virtual environment where we run the code. Creating a virtual environment is recommended for this project.

That's it. The environment is setup now.

Running the Timelapse Generator:

If you already have the FITS files generated by PANOPTES units, directly go to Step 2

  • Step 1:

    • Get the FITS files from Panoptes Observations Explorer by choosing the sequence from the list and downloading the text file containing the urls.
    • You can download the FITS files using wget or curl or you can use the provided download.py script provided for convenience.
    • USAGE:
      (pan-tg)$ python3 download.py --help to see the help text Linux
      (pan-tg)$ download.py --help to see the help text Windows
      (pan-tg)$ python3 download.py -i <path_to_text_file> -o <path_to_dir> Linux
      (pan-tg)$ download.py -i <path_to_text_file> -o <path_to_dir> Windows
  • Step 2:

    • Activate the virtual environment that has been setup as described in the OS specific instructions above.
    • The timelapse generator is called as follows:
      (pan-tg)$ time_gen.py -i <path_to_fits_files> -o <output_path>
      (pan-tg)$ time_gen.py --help to see all options.
      (pan-tg)$ time_gen.py -i <path_to_fits_files> is the simplest to use.
      (pan-tg)$ time_gen.py -i <path_to_fits_files> --full_hd to force output video to be 1920 x 1080p
      (pan-tg)$ time_gen.py -i <path_to_fits_files> --m 1 --n 2 --cell 0 1 to specify that the image is to be divided into 1 Row (m) and 2 Columns (n) and to get the sub-image specified by cell (0,1) i.e 0th row index and 1st column index.
    • On Ubuntu, you will have to prefix the commands with python3 to get them to work. The shebangs were removed because they broke Windows support. Example:
      (pan-tg)$ python3 time_gen.py -i <path_to_fits_files> -o <output_path>
      (pan-tg)$ python3 time_gen.py --help to see all options.
      (pan-tg)$ python3 time_gen.py -i <path_to_fits_files> is the simplest to use.
      (pan-tg)$ python3 time_gen.py -i <path_to_fits_files> --full_hd to force output video to be 1920 x 1080p
      (pan-tg)$ python3 time_gen.py -i <path_to_fits_files> --m 1 --n 2 --cell 0 1 to specify that the image is to be divided into 1 Row (m) and 2 Columns (n) and to get the sub-image specified by cell (0,1) i.e 0th row index and 1st column index.

Performance:

The timelapse generator takes around 20 seconds to process each FITS file. The video generation takes additional time and is faster if the --full_hd flag is set.

For debugging purposes, logging has been setup. The logs.log file contains the log from the most recent run of the timelapse generator.

Troubleshooting Help:

  • Check if you are running from the right virtual environment if you have configured it.
  • Check the version of the Python that the script is running from. The scripts are written to work with Python 3.
  • If Windows complains that it couldn't find libopenh264-*.dll you can safely ignore it. We're not using libopenh264 components here.
  • If using mp4v encoding, the output file may not play with the default codecs present on the system. It is recommended that you try opening them with vlc media player.
  • The output timelapses are currently tinted green. This issue is being considered and we're exploring ways to correct it.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages