AU-ExoMars / PCOT

Pancam Operations Toolkit
MIT License
3 stars 0 forks source link

PCOT

This is an early version of the Pancam Operations Toolkit. This is a Python application and library primarily intended for processing data from the Pancam instrument on the Rosalind Franklin rover, although it lends itself to any task involving processing multispectral image data.

For example, with PCOT you can:

and many other things besides. PCOT is highly extensible and open-source, so any missing functionality is easily added.

PCOT operates on a graph model - the data is processed through a set of nodes which manipulate it in various ways (e.g. add regions of interest, perform maths, splice images together, merge image channels, plot spectra). A PCOT document describes this graph, and we intend that documents are distributed along with the data they generate to help reproducibility.

More documentation can be found here

Installation

PCOT is a Python program (and library) with a number of dependencies, notably numpy and PySide2 (the official Python interface to Qt). We find the best way to manage these is to use Anaconda and Poetry. Installation has been tested on Windows 10, MacOS and Ubuntu 20.04.

Install Anaconda

The first thing you will need to do is install Anaconda, which can be done from here:

Obtain the software

This can be done by either downloading the archive from Github and extracting it into a new directory, or cloning the repository. In both cases, the top level directory should be called PCOT (this isn't really mandatory but makes the instructions below simpler). The best way to download is this:

Opening Anaconda's shell on different OSs

Installing on Ubuntu / MacOS

Assuming you have successfully installed Anaconda and cloned or downloaded PCOT as above:

Installing on Windows

Assuming you have successfully installed Anaconda and cloned or downloaded PCOT as above:

Running PCOT

Open an Anaconda shell and run the following commands (assuming you installed PCOT into your home directory):

cd PCOT
conda activate pcot
pcot

Create an 'executable' icon (MacOS)

Note: these instructions were created and tested under MacOS but should be usable on other systems with some adaptation.

The above commands can be put into a bash script which will allow PCOT to be run by clicking on an icon.

Open a text editor (e.g. TextEdit, Notepad++, Sublime, etc) and create a new file called pcot.sh, and save it to your desktop (or wherever you want the icon). Add the following to this file:

#!/usr/bin/env bash
eval "$(conda shell.bash hook)"
conda activate pcot
pcot

Open a terminal window and navigate to the location of your new script, then run the following command to give it permission to run:

chmod +x pcot

You can now use the icon to run PCOT.

Note: you may need to set up your system to open .sh files with Terminal by default.

Running PCOT inside Pycharm

These instructions may be useful if you want to run PCOT inside a debugger - for example, if you are testing a custom node.

Environment variables

It's a good idea, but not mandatory, to set the environment variable PCOTUSER to a string of the form name <email>. For example, in Linux I have added the following to my .bashrc file:

export PCOT_USER="Jim Finnis <jcf12@aber.ac.uk>"

This data is added to all saved PCOT graphs. If the environment variable is not set, the username returned by Python's getpass module is used (e.g. 'jcf12').

Common runtime issues

Can't start Qt on Linux

This sometimes happens:

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Try this:

export QT_DEBUG_PLUGINS=1
pcot

to run the program again, and look at the output. You might see errors like this (I've removed some stuff):

QFactoryLoader::QFactoryLoader() checking directory path "[...]envs/pcot/bin/platforms" ...
Cannot load library [...]/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "...[stuff removed].. (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)"

If that's the case, install the missing package:

sudo apt install libxcb-xinerama0

That should help. Otherwise, send a message to us with the output from the QT_DEBUG_PLUGINS run and we will investigate.