morphops.io

Provides IO functions to read from and write to files in common landmark data file formats.

exception morphops.io.MopsFileReadError[source]

Bases: Exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception morphops.io.MopsFileWriteError[source]

Bases: Exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

morphops.io.read_dta(filename)[source]

Reads *.dta files, as written by the IDAV Landmark Editor.

dta files typically have the following structure.

  1. Few comment lines. Comment lines start with a quotation mark (’ or “).

  2. A header with structure “1 nL pk 1 9999 Dim=k”. Here

    1. n is the number of specimens or number of landmark sets
    2. L in “nL” indicates that the file has specimen labels - assumed true
    3. p is the number of landmarks per landmark set
    4. k is the number of coordinates of each landmark (usually 2 or 3)

    The “1 9999” are ignored (but expected to exist) when reading. This is because those two numbers are a misapplication of the NTS format, which the DTA format is based on. Per the NTS format, the interpretation of the “1 9999” is that the file has missing data indicated by 9999. DTA files always contain the “1 9999” numbers, regardless of whether the file actually has missing data.

  3. n lines, each corresponding to the label of 1 specimen.

  4. n blocks of p lines. Each line contains k numbers. These correspond to p k-D landmarks in each of the n specimens specified in the order of appearance of their names in the preceding section.

morphops.io.write_dta(filename, lmk_sets, names=[])[source]

Writes *.dta files, as written by the IDAV Landmark Editor.

See also

read_dta()
For an explanation of the *.dta format.