Skip to content

LCOGT/atik-titan-pilot

Repository files navigation

atik-titan-pilot

Summary

This project contains all the components for performing an LCOGT pilot test of the Atik Titan camera.

The goals is to wrap the C/C++ Artik/Artemis code in Python.

To build:

c:\<project-dir>\build.bat

To run test program:

c:\<project-dir>\artemis.bat

Special Functions

In general the Artemis SDK functions work as explained in the Artemis SDK documentation.

Argument Return Values

Functions that take pointers for use as return values have been modified.

Function Name Example
ArtemisGetImageData return_code, x, y, w, h, bin_x, bin_y = ArtemisGetImageData(device_handle)
ArtemisGetSubframe return_code, x, y, w, h = ArtemisGetSubframe(device_handle)
ArtemisGetBin return_code, x, y = ArtemisBin(device_handle)
ArtemisColourProperties return_code, colour_type, normal_offset_x, normal_offset_y, preview_offset_x, preview_offset_y = ArtemisColourProperties(device_handle)
Type Conversion

Functions whose return types are not inherently compatible with Python now have similarly-named wrapper functions.

Name/Source Return Type Example
ArtemisDeviceName_pythonString
ArtemisDeviceName
PyString device_name = ArtemisDeviceName_pythonString(device_number)
ArtemisDeviceSerial_pythonString
ArtemisDeviceSerial
PyString device_serial = ArtemisDeviceSerial_pythonString(device_number)
ArtemisProperties_pythonDictionary
ArtemisProperties
PyDict device_properties = ArtemisProperties_pythonDictionary(device_handle)
ArtemisImageBuffer_pythonList
ArtemisImageBuffer
PyList device_serial = ArtemisImageBuffer_pythonList(device_handle)
Problematic Functions

The following functions are unimplemented, or not recommended.

Name Reason
ArtemisFTNameDeprecated
ArtemisFTSerialDeprecated
ArtemisGetImageArrayUnknown behavior. Replaced by ArtemisImageBuffer_pythonList
ArtemisSendPeripheralMessageDiagnostic method: currently unnecessary
ArtemisIsLicensedDiagnostic method: currently unnecessary
All of these methods may be implemented by modifying the artemishsc.i. For example, given int example(float *response):
%apply int *OUTPUT { float *response};
int example(float *response);

Files

<tr><td><code>artemis.bat</code></td><td>Wrapper to execute <code>artemis.py<code></td></tr>
<tr><td><code>artemis.py</code></td><td>Example Python script exercising the Artemis API (outputs <code>titan.fits</code>)</td></tr>
<tr><td><code>artemishsc.i</code></td><td>The <a href="http://www.swig.org/">SWIG</a> interface file</td></tr>
<tr><td><code>artemishsc.py</code></td><td>yyy</td></tr>
<tr><td><code>artemishsc.pyc</code></td><td><i>Auto-generated by SWIG</i></td></tr>
<tr><td><code>artemishsc_wrap.c</code></td><td><i>Auto-generated by SWIG</i></td></tr>
<tr><td><code>ArtemisHscAPI.cpp</code></td><td>The Artemis SDK code (vendor provided)</td></tr>
<tr><td><code>ArtemisHscAPI.h</code></td><td>The Artemis SDK header (vendor provided)</td></tr>
<tr><td><code>build.bat</code></td><td>Builds the <code>lib/artemishsc.pyc</code> SWIG-generated Python library</td></tr>
<tr><td><code>lib/</code></td><td>Output directory for the Python library build process</td></tr>
<tr><td><code>README.md</code></td><td>Source for this document</td></tr>
<tr><td><code>setup.py</code></td><td>Python setup script for the Python library build</td></tr>
<tr><td><code>shared/</code></td><td>A collection of libraries required by the Artemis SDK</td></tr>
<tr><td><code>stdafx.h</code></td><td>Placeholder for unneeded (but included) C header file</td></tr>
Filename Description

Installation & Setup

Steps:

  1. Install the Atik USB Drivers
  2. Install the Artemis Universal Package (e.g. SDK, DLLs)
  3. Install the Anaconda Python Environment
  4. Install SWIG for Windows
  5. Install Minimal GNU for Windows 32-bit (MinGW)
  6. Install the Git Version Control System
  7. Update the PATH environment variable to point to the following directories:
    1. c:\MinGW\mingw32\bin
    2. c:\Program Files\swigwin-xxx
    3. c:\Anaconda
    4. c:\Anaconda\Scripts
    5. c:\Program Files (x86)\Git\bin
    6. c:\Program Files (x86)\Git\cmd
  8. Set the PYTHONHOME environment variable to c:\Anaconda
  9. Update the PYTHONPATH environment variable to the following directories:
    1. %PYTHONHOME%\Lib
    2. %PYTHONHOME%\DLLs
    3. %PYTHONHOME%\libs
    4. %HOMEPATH%\workspace\titan
  10. Checkout the project:
    1. From your home directory: mkdir workspace
    2. cd workspace
    3. Ensure you have a SSH key and that Github has it installed: see Generating SSH Keys
    4. Checkout the project: git clone git@github.com:LCOGT/atik-titan-pilot.git titan
    5. Modify the Python environment. Sadly, there is a small incompatibility within the Python library distutils module. To fix this, do the following:
      1. Open %PYTHONHOME%\Lib\distutils\cygwinccompiler.py
      2. Search for the Mingw32CCompiler class
      3. Find the self.set_executables method call
      4. Within the call's parameters, change all gcc values to g++
      5. Within the same class, make sure all no_cygwin variables are the empty string.
      6. Within the overall file, search for extra_preargs.extend, replace all --output-lib strings to -o
  11. Try a test build;
    1. From PowerShell change into the %HOMEPATH%\workspace\titan directory
    2. Execute: build.bat
    3. If the build is successful run the test program:
      1. Ensure the camera's USB cable is connected
      2. Execute artemis.bat
      3. If the execution is successful, view the resultant artemis.fits file

Reference

About

Python wrapper for Artemis HSC API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages