Next / Previous / Contents / TCC Help System / NM Tech homepage

6. A Python object for the catalog

The module is a Python module containing a class that represents the contents of a slide catalog.

This section describes the external interface to the module. For the actual code of the module, see Section 7, “ Internals”.

6.1. The ImageCatalog object

To access the image catalog:

from import *

C = ImageCatalog.readFile(filename)

where filename is the name of the image catalog. If omitted, this file name defaults to “birdimages.xml” in the current directory. If the file does not exist or is not well-formed, this method will raise IOError.

The code above would set cat to an instance of the ImageCatalogclass. An ImageCatalog instance C exports these methods:


If the catalog contains an original image whose catalog number matches catNo, the method returns an Original instance that represents the catalog entry. See Section 6.2, “class Original: One bird slide catalog entry”.

If the catalog contains no image with that number, the method raises a KeyError exception.


Using a Python generator, this method generates all the entries in C as instances of class Original, in ascending order by catalog number.


This method generates, as a sorted sequence of Original instances, all the catalog entries that contain a given kind of bird. The argument birdId is a string whose syntax is described in A system for representing bird taxonomy, in the section on the module.

Typically the argument is a six-letter bird code (e.g., "BALEAG" for Bald Eagle), but it may also be a string representing a species pair (e.g., "DOWWOO|HAIWOO" for Downy or Hairy Woodpecker) or a hybrid (e.g., "AMEWIG^EURWIG for American × European Wigeon).

A question mark may be appended to any of the above values, e.g., “HAMFLY?” or “AMEWIG^EURWIG?”. If a form appears both with and without the question mark, that is considered two different forms.

6.2. class Original: One bird slide catalog entry

An instance of this class represents one catalog entry. The related schema pattern is described in Section 4.3, “original: Data for one exposure”.

An instance O of class Original exports these read-only attributes:


The catalog number.


The full ab6 attribute, containing one or more bird ID strings.


State code.


The qual attribute, if any, otherwise an empty string.


The scan attribute as an integer, if present; otherwise None.


The contents of the loc element, or an empty string if that element is missing.


The contents of the note element, or an empty string.

The text from the film element if present, or an empty string.


The light description from the light element, or an empty string.


Behavior notes from the beh element, or an empty string.


Description from the desc element, or an empty string.


Posing information from the pose element, or an empty string.