Image operations (pyobs.modules.image)

Modules for image operations. TODO: write doc

ImageWatcher

class ImageWatcher(watchpath: str, destinations: Optional[List[str]] = None, poll: bool = False, poll_interval: int = 5, wait_time: int = 10, pattern: str = '*', **kwargs: Any)

Bases: pyobs.modules.Module

Watch for new files and write them to all given destinations.

Watches a path for new files and stores them in all given destinations. Only if all operations were successful, the file is deleted.

Create a new image watcher.

Parameters:
  • watchpath – Path to watch.

  • destinations – Filename patterns for destinations.

  • poll – If True, watchpath is polled instead of watched by inotify.

  • poll_interval – Interval for polling in seconds, if poll is True.

  • wait_time – Time in seconds between adding file to list and processing it.

add_file(filename: str) None[source]

Add a file to the file queue.

Parameters:

filename (str) – Local filename of new file.

async cleanup_extra(filename: str) None[source]

Can be overwritten by derived classes to do clean up after successful copying. All information are stored in self.current_file and can be checked against the given filename.

Parameters:

filename – Input name of original file.

async close() None[source]

Close image watcher.

async open() None[source]

Open image watcher.

async process_extra(filename: str) bool[source]

Can be overwritten by derived classes to do extra processing on files. All information are stored in self.current_file and can be checked against the given filename.

Parameters:

filename – Input name of original file.

Returns:

Whether processing was successful

ImageWriter

class ImageWriter(filename: str = '/archive/{FNAME}', sources: Optional[Union[str, List[str]]] = None, **kwargs: Any)

Bases: pyobs.modules.Module

Writes new images to disk.

Creates a new image writer.

Parameters:
  • filename – Pattern for filename to store images at.

  • sources – List of sources (e.g. cameras) to process images from or None for all.

async open() None[source]

Open image writer.

async process_new_image_event(event: pyobs.events.Event, sender: str) bool[source]

Puts a new images in the DB with the given ID.

Parameters:
  • event – New image event

  • sender – Who sent the event?

Returns:

Success

Seeing

class Seeing(sources: Optional[Union[str, List[str]]] = None, publisher: Optional[Union[pyobs.utils.publisher.publisher.Publisher, Dict[str, Any]]] = None, max_ellipticity: float = 0.2, correct_for_airmass: bool = True, **kwargs: Any)

Bases: pyobs.modules.Module

Measures seeing on reduced images with a catalog.

Creates a new seeing estimator.

Parameters:
  • sources – List of sources (e.g. cameras) to process images from or None for all.

  • publisher – Publisher to publish results to.

  • max_ellipticity – Maximum ellipticity for sources to consider.

  • correct_for_zenith – Whether to correct seeing for airmass.

async open() None[source]

Open module.

async process_new_image_event(event: pyobs.events.Event, sender: str) bool[source]

Puts a new images in the DB with the given ID.

Parameters:
  • event – New image event

  • sender – Who sent the event?

Returns:

Success