Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed Apr 8, 2018
0 parents commit df52991
Show file tree
Hide file tree
Showing 110 changed files with 13,923 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.pytest_cache/*

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/
docs/index.doctree

# test results
matplotlibrc
*psyplot_testresults
tests/envs/cov_psyplot_py*
tests/envs/psyplot_py*.html

# PyBuilder
target/

# Spyder project
.spyderproject

# Example ipython notebook checkpoints
*.ipynb_checkpoints/

# test pictures
tests/test_diagram*.png
tests/chinese.*

*.pkl
296 changes: 296 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include README.rst
include LICENSE
include straditize/widgets/icons/*.png
include straditize/widgets/docs/*.rst
include straditize/widgets/docs/*.png
57 changes: 57 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
=================================
Digitizing stratigraphic diagrams
=================================

STRADITIZE (Stratigraphic Diagram Digitizer) is an open-source program that
allows stratigraphic figures to be digitized in a single semi-automated
operation. It is designed to detect multiple plots of variables analyzed along
the same vertical axis, whether this is a sediment core or any similar
depth/time series.

Usually, in an age of digital data analysis, gaining access to data from the
pre-digital era – or any data that is only available as a figure on a page –
remains a problem and an under-utilized scientific resource.

This program tackles this problem by providing a python package to digitize
especially pollen diagrams, but also any other type of stratigraphic diagram.

Straditize is written in python and supports mixtures of many different diagram
types, such as bar plots, line plots, as well as shaded, stacked, and filled
area plots. The package provides an extensively documented graphical user
interface for a point-and-click handling of the semi-automatic process, but can
also be scripted or used from the command line. Other features of STRADITIZE
include text recognition to interpret the names of the different plotted
variables, the automatic and semi-automatic recognition of picture artifacts,
as well an automatic measurement finder to exactly reproduce the data that has
been used to create the diagram.

**BETA-VERSION**: Straditize is currently in it's beta version. New
installation methods will be provided and the documentation will be
significantly improved.

EGU Presentation
-----------------
straditize will be presented at the European Geosciences Union General
Assembly (EGU) 2018 as a `PICO presentation`_ in the session of
`Free and Open Source Software (FOSS) for Geoinformatics and Geosciences`_.

The PICO presentation files can be downloaded via http://dx.doi.org/10.13140/RG.2.2.34357.58083

.. _PICO presentation: https://meetingorganizer.copernicus.org/EGU2018/EGU2018-4433.pdf
.. _Free and Open Source Software (FOSS) for Geoinformatics and Geosciences: https://meetingorganizer.copernicus.org/EGU2018/session/26511

Installation
------------
At the moment, straditize has to be installed from the source files, i.e. the
github repository. We highly recommend to use anaconda_ and install the
dependencies via::

conda config --add channels conda-forge
conda install -c chilipp/label/dev psyplot-gui scikit-image
git clone https://github.com/Chilipp/straditize.git
cd straditize
python setup.py install

It can then be started from the command line via::

straditize
13 changes: 13 additions & 0 deletions icon/CreateICNS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mkdir main.iconset
sips -z 16 16 icon1024.png --out main.iconset/icon_16x16.png
sips -z 32 32 icon1024.png --out main.iconset/icon_16x16@2x.png
sips -z 32 32 icon1024.png --out main.iconset/icon_32x32.png
sips -z 64 64 icon1024.png --out main.iconset/icon_32x32@2x.png
sips -z 128 128 icon1024.png --out main.iconset/icon_128x128.png
sips -z 256 256 icon1024.png --out main.iconset/icon_128x128@2x.png
sips -z 256 256 icon1024.png --out main.iconset/icon_256x256.png
sips -z 512 512 icon1024.png --out main.iconset/icon_256x256@2x.png
sips -z 512 512 icon1024.png --out main.iconset/icon_512x512.png
cp icon1024.png main.iconset/icon_512x512@2x.png
iconutil -c icns main.iconset
rm -R main.iconset
1 change: 1 addition & 0 deletions icon/CreateICO.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
convert icon1024.png -define icon:auto-resize=64,48,32,16 straditize.ico
49 changes: 49 additions & 0 deletions icon/icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Create the psyplot icon
This script creates the psyplot icon with a dpi of 128 and a width and height
of 8 inches. The file is saved it to ``'icon1024.png'``"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.colors as mcol

fig = plt.figure(figsize=(8, 8), dpi=128)

ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], facecolor='none')
ax.axis('off')

cmap = plt.get_cmap('binary')

xlines = np.arange(0, 41, 5)
nlines = len(xlines)

colors = np.r_[cmap(np.linspace(0, 0.9, nlines // 2)),
cmap(np.linspace(0, 0.9, nlines // 2))[::-1]]

full_cmap = mcol.LinearSegmentedColormap.from_list('Reds_sedR', colors,
nlines)

x = np.array([
2, 5, 1, 8, 0, 5, 0, 6, 1, 4, 7, 5, 1, 1, 5, 0, 4, 0, 6, 1, 4, 1, 5, 2, 6,
8, 5, 0, 3, 0, 6, 2, 1, 3, 2, 5, 7, 5, 4, 3])

for i in xlines:
ax.plot(x + i, np.arange(len(x)), color=full_cmap(i/40.), lw=10.0)

patch = mpatches.Circle((0.5, 0.5), radius=0.49, transform=ax.transAxes,
facecolor='k', zorder=0.5)
# the border of the circle
border = mpatches.Circle((0.5, 0.5), radius=0.49, transform=ax.transAxes,
facecolor='none', edgecolor='lightgray', linewidth=10,
zorder=10)

for l in ax.lines:
l.set_clip_path(patch)

ax.add_patch(patch)
ax.add_patch(border)

ax.set_xlim(0, 45)
ax.set_ylim(2.5, 40)

plt.savefig('icon1024.png', transparent=True)
Binary file added icon/icon1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon/main.icns
Binary file not shown.
Binary file added icon/straditize.ico
Binary file not shown.
64 changes: 64 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os.path as osp
from setuptools import setup, find_packages
import sys

needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []


def readme():
with open('README.rst') as f:
return f.read()


# read the version from version.py
with open(osp.join('straditize', 'version.py')) as f:
exec(f.read())


setup(name='straditize',
version=__version__,
description='Python package for digitizing pollen diagrams',
long_description=readme(),
classifiers=[
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Scientific/Engineering :: GIS',
'Topic :: Scientific/Engineering',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Operating System :: OS Independent',
],
keywords=('visualization earth-sciences paleo climate paleoclimate '
'pollen diagram digitization database'),
url='https://github.com/Chilipp/straditize',
author='Philipp Sommer',
author_email='philipp.sommer@unil.ch',
license="GPLv2",
packages=find_packages(exclude=['docs', 'tests*', 'examples']),
install_requires=[
'psyplot',
'psyplot-gui>1.0.1',
'scipy',
'scikit-image',
],
package_data={'straditize': [
osp.join('straditize', 'widgets', 'icons', '*.png'),
osp.join('straditize', 'widgets', 'docs', '*.rst'),
osp.join('straditize', 'widgets', 'docs', '*.png'),
]},
include_package_data=True,
setup_requires=pytest_runner,
tests_require=['pytest'],
entry_points={
'console_scripts': ['straditize=straditize.__main__:main'],
'psyplot_gui': ['straditizer=straditize.widgets:StraditizerWidgets'],
},
zip_safe=False)
1 change: 1 addition & 0 deletions straditize/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from straditize.version import __version__
Loading

0 comments on commit df52991

Please sign in to comment.