Skip to content

Commit

Permalink
adding key files
Browse files Browse the repository at this point in the history
  • Loading branch information
nlsschim committed Apr 17, 2024
1 parent 99dcc50 commit fecee5e
Show file tree
Hide file tree
Showing 41 changed files with 5,830 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: python
python:
- "3.5"
install:
- pip install -e . --use-mirrors
before_script:
- pip install -r requirements.txt --use-mirrors
- git clone https://github.com/ccurtis7/diff_classifier.git
- cd ./diff_classifier/diff_classifier/tests/
script:
- py.test test_features.py --doctest-modules --pep8 coveralls -v --cov coveralls --cov-report term-missing
- py.test test_imagej.py --doctest-modules --pep8 coveralls -v --cov coveralls --cov-report term-missing
- py.test test_msd.py --doctest-modules --pep8 coveralls -v --cov coveralls --cov-report term-missing
- py.test test_utils.py --doctest-modules --pep8 coveralls -v --cov coveralls --cov-report term-missing
after_success:
- coveralls
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
branch = True
source = diff_classifier/*
include = diff_classifier/*
omit = */setup.py
[report]
include = diff_classifier/*
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff_classifier/__pycache__
*.csv
*.tif
diff_classifier/notebooks/.ipynb_checkpoints/*
*.cache
diff_classifier/tests/__pycache__
*-checkpoint.ipynb
*.pyc
*.egg-info
notebooks/cloudknot_docker*
*.swp
*.png
*.travis.yml
*.DS_store
62 changes: 62 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

You can contribute in many ways:

## Types of Contributions

### Report Bugs

Report bugs at https://github.com/ccurtis7/diff_classifier/issues.

If you are reporting a bug, please include:

- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.

### Work on "good first issues"

Look through the GitHub issues for anything labelled "good first issue." These
are issues that we think would be especially appropriate for those new to
open-source software contribution.

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

When submitting a new feature, please use a [Pull Request](https://scikit-learn.org/dev/developers/contributing.html#how-to-contribute) with a title and description
of the proposed use case. Ideally, new features will include

- Docstrings implemented with the [Numpy format](https://www.numpy.org/devdocs/docs/howto_document.html)
- Unit tests (see examples [here](https://github.com/ccurtis7/diff_classifier/tree/master/diff_classifier/tests))

### Write Documentation

Diff_classifier could always use more documentation, whether as part of the
official afq-insight docs, in docstrings, or even on the web in blog posts,
articles, and such.

### Submit Feedback

We appreciate any and all feedback in your own implementations of diff_classifier :)

The best way to send feedback is to file an issue at
https://github.com/ccurtis7/diff_classifier/issues.



If you are proposing a feature:

- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions
are welcome :)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 ccurtis7

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## diff_classifier
[![status](http://joss.theoj.org/papers/003901de75c26c1dd3f060043249bc4f/status.svg)](http://joss.theoj.org/papers/003901de75c26c1dd3f060043249bc4f)
[![Build Status](https://travis-ci.org/ccurtis7/diff_classifier.svg?branch=master)](https://travis-ci.org/ccurtis7/diff_classifier)
[![Coverage Status](https://coveralls.io/repos/github/ccurtis7/diff_classifier/badge.svg)](https://coveralls.io/github/ccurtis7/diff_classifier)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/ccurtis7/diff_classifier.svg)](https://scrutinizer-ci.com/g/ccurtis7/diff_classifier/?branch=master)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/ccurtis7/diff_classifier.svg)](http://isitmaintained.com/project/ccurtis7/diff_classifier "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/ccurtis7/diff_classifier.svg)](http://isitmaintained.com/project/ccurtis7/diff_classifier "Percentage of issues still open")
[![GitHub license](
https://img.shields.io/github/license/ccurtis7/diff_classifier.svg)](https://github.com/ccurtis7/diff_classifier/blob/master/LICENSE)
[![DOI](https://zenodo.org/badge/116980257.svg)](https://zenodo.org/badge/latestdoi/116980257)


diff_classifier is a python package for analyzing and visualizing 2D
nanoparticle trajectory data from multi-particle tracking analysis. The package
utilizes the ImageJ package Trackmate for tracking analysis, and Cloudknot for
parallelization on AWS.

<p align="center"><img src="doc/source/_static/summary.png"
alt="diff_classifier" height="300" title="diff_classifier"/></p>


This is the diff_classifier development site. You can view the source code and
file new issues. If you are just getting started, you should look at the
[diff_classifier documentation](https://Nance-Lab.github.io/diff_classifier/)

## Contributing

Contributions are welcome! Diff_classifier is open source, built on open source,
and we love any input, suggestions, and problems.

[Guidelines](CONTRIBUTING.md) for contributing are included for your convenience.

## Credits

This package was created with [shablona](https://github.com/uwescience/shablona).

Guidelines for contributions were based off the
[CONTRIBUTIONS](https://github.com/richford/cloudknot/blob/master/CONTRIBUTING.md)
file developed by [Adam Richie-Halford](https://github.com/richford).
Empty file added diff_classifier/__init__.py
Empty file.
85 changes: 85 additions & 0 deletions diff_classifier/aws.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""IO functions for downloading and uploading files from AWS S3 buckets.
The diff_classifier module was built to be used with conjunction with AWS
services. With the exception of Cloudknot parallelization capabilities, most
functions can be used separate from AWS. These functions faciliate interaction
with files stores in S3 buckets. Users must have appropriate credentials to
access desired S3 buckets.
"""
import os
import os.path as op

import boto3


# import diff_classifier.imagej as ij


def download_s3(remote_fname, local_fname, bucket_name="ccurtis.data"):
"""Download a file from S3 to local file-system
Parameters
----------
remote_fname: string
Name of remote file in S3 bucket.
local_fname: string
Desired name to be stored on local computer.
bucket_name: string
Bucket name on S3.
"""
if not os.path.exists(local_fname):
sthree = boto3.resource('s3')
buckt = sthree.Bucket(bucket_name)
buckt.download_file(remote_fname, local_fname)


def upload_s3(local_fname, remote_fname, bucket_name="ccurtis.data"):
"""
Upload a file from local file-system to S3.
Parameters
----------
local_fname: string
Name of local file stored on computer.
remote_fname: string
Desired name to be stored in S3 bucket.
bucket_name: string
Bucket name on S3.
"""

sthree = boto3.resource('s3')
buckt = sthree.Bucket(bucket_name)
buckt.upload_file(local_fname, remote_fname)


# def partition_and_store(remote_fname, local_dir, bucket_name="ccurtis7.pup"):
# """
# Download image from S3, partition, and upload partitions to S3.

# Parameters
# ----------
# remote_fname: string
# Target filename in S3 bucket.
# local_dir: string
# Local directory to store downloaded file.
# bucket_name: string
# Bucket name on S3.

# Returns
# -------
# remote_names: list of strings.
# Names of partitioned images in S3.
# """
# remote_dir, remote_file = op.split(remote_fname)
# download_s3(remote_fname, op.join(local_dir, remote_file))
# names = ij.partition_im(op.join(local_dir, remote_file))

# remote_names = []
# for file in names:
# local_file = op.split(file)[1]
# upload_s3(op.join(local_dir, local_file), op.join(remote_dir, local_file))
# remote_names.append(op.join(remote_dir, local_file))
# return remote_names
74 changes: 74 additions & 0 deletions diff_classifier/due.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# emacs: at the end of the file
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
"""
Stub file for a guaranteed safe import of duecredit constructs: if duecredit
is not available.
To use it, place it into your project codebase to be imported, e.g. copy as
cp stub.py /path/tomodule/module/due.py
Note that it might be better to avoid naming it duecredit.py to avoid shadowing
installed duecredit.
Then use in your code as
from .due import due, Doi, BibTeX
See https://github.com/duecredit/duecredit/blob/master/README.md for examples.
Origin: Originally a part of the duecredit
Copyright: 2015-2016 DueCredit developers
License: BSD-2
"""
from __future__ import absolute_import, division, print_function

__version__ = '0.0.5'


class InactiveDueCreditCollector(object):
"""Just a stub at the Collector which would not do anything"""
def _donothing(self, *args, **kwargs):
"""Perform no good and no bad"""
pass

def dcite(self, *args, **kwargs):
"""If I could cite I would"""
def nondecorating_decorator(func):
return func
return nondecorating_decorator

cite = load = add = _donothing

def __repr__(self):
return self.__class__.__name__ + '()'


def _donothing_func(*args, **kwargs):
"""Perform no good and no bad"""
pass


try:
from duecredit import due, BibTeX, Doi, Url
if 'due' in locals() and not hasattr(due, 'cite'):
raise RuntimeError(
"Imported due lacks .cite. DueCredit is now disabled")
except Exception as e:
if type(e).__name__ != 'ImportError':
import logging
logging.getLogger("duecredit").error(
"Failed to import duecredit due to %s" % str(e))
# Initiate due stub
due = InactiveDueCreditCollector()
BibTeX = Doi = Url = _donothing_func

# Emacs mode definitions
# Local Variables:
# mode: python
# py-indent-offset: 4
# tab-width: 4
# indent-tabs-mode: nil
# End:
Loading

0 comments on commit fecee5e

Please sign in to comment.