Skip to main content

morphostuff

coverage version MIT License

A small python package to aid morphometric analysis. Automates allometric correction and principal component analysis.

Table of Contents

Installation

morphostuff is not in PyPI yet, but I plan to add it in soon. In the meantime, it can be downloaded from GitHub using pip.

python -m pip install morphostuff@git+https://github.com/holsfastagz/morphostuff.git

Execution / Usage

Importing

You can import morphostuff into a Python script like so:

import morphostuff as mstuff

allom Function

Ensure your data are in the proper format. The first column (index 0) should consist of the species name or other identifying information. The second column (index 1) should consist of a standard body length measurement such as SVL. The following columns (indices 2:) should consist of other measurements.

The allom function only requires a data frame as input. A Polars data frame is recommended, but it can also take a Pandas data frame as input. Example:

morph_data = pl.read_csv('morph_data.csv')

allom_data = mstuff.allom(morph_data)

This function outputs a table of allometrically corrected features.

Use help(mstuff.allom) for more information.

morph_pca Function

The input of this function should be a data frame of allometrically corrected characters (i.e., the output of allom). It should follow the same structure as the allom inputs.

morpho_data = mstuff.morph_pca(allom_data)

This function outputs a table containing allometric size corrections, a table containing PCA results, and a PCA biplot.

Use help(mstuff.morpho_data) for more information.

significant_features Function

This function will determine how many principal components account for at least 90% of explained variance and which characters weigh heavily on each PC according to the following formula:

$$ \sqrt{\frac{1} {\mathrm{no. \ of\ characters}}} $$

The input of this function should be the data frame generated as output of morph_pca.

significant_features = mstuff.significant_features(morpho_data)

This function outputs a scree plot, barplots for each PC, a table of loadings of the significant PCS, and a table of significance of each character by PC. These outputs are all written to the disk.

Use help(mstuff.significant_features) for more information.

Technologies

morphostuff uses the following technologies and tools:

Contributing

To contribute to the development of morphostuff, follow the steps below:

  1. Fork morphostuff from https://github.com/holsfastagz/morphostuff/fork
  2. Create your feature branch (git checkout -b feature-new)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add some new feature')
  5. Push to the branch (git push origin feature-new)
  6. Create a new pull request

Author

Holsen B. Moore - @h0ls.bsky.social - holsenmoore@utexas.edu

Change Log

  • 0.1
    • First working version.

License

morphostuff is distributed under the MIT license. See LICENSE for more details.

Metadata

Release files for morphostuff 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for morphostuff 0.1
File Size Uploaded
morphostuff-0.1.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for morphostuff 0.1
File Interpreter ABI Platform
morphostuff-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.1 kB

Release files / morphostuff-0.1.tar.gz

Download URL morphostuff-0.1.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6e285b64a208cd3fbd665d2d6623d858918355c980fbca7bd3b093a61a075ad4
BLAKE2b-256 checksum
How to use checksums
8ac4589cc875845f885792529ff2d1e925c503bed3c4acc8b864c9865f74f9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release files / morphostuff-0.1-py3-none-any.whl

Download URL morphostuff-0.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cb5fb956a43798021870d6f5a809d75dc672147ed3066f1c3f08efa44378f79
BLAKE2b-256 checksum
How to use checksums
36a16ebc6c9a08116505fe90ad0625f06b83d64a60ebfceec2bdfbd68b417c7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page