Skip to content

Commit 7ed75dd

Browse files
committed
Restructure project into a named package
1 parent b93d7b2 commit 7ed75dd

27 files changed

+47
-22
lines changed

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Martin Drawitsch
3+
Copyright (c) 2021 - 2022 Martin Drawitsch
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Diff for: __init__.py renamed to emcaps/__init__.py

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: class_info.yaml renamed to emcaps/class_info.yaml

File renamed without changes.
File renamed without changes.

Diff for: inference/patchifyseg.py renamed to emcaps/inference/patchifyseg.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
from elektronn3.data import transforms
3434
from elektronn3.models.unet import UNet
3535

36-
from analysis.radial_patchlineplots import measure_outer_disk_radius
37-
import utils
36+
from emcaps.analysis.radial_patchlineplots import measure_outer_disk_radius
37+
from emcaps import utils
3838

3939

4040
def eul(paths):

Diff for: inference/patchmodel_eval.py renamed to emcaps/inference/patchmodel_eval.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515

1616
import imageio
1717
import matplotlib.pyplot as plt
18-
import yaml
1918
import torch
2019
import numpy as np
2120
import pandas as pd
2221
from tqdm import tqdm
23-
from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay
24-
22+
from sklearn.metrics import confusion_matrix
2523

2624
# Don't move this stuff, it needs to be run this early to work
2725
import elektronn3
@@ -31,10 +29,7 @@
3129
from elektronn3.data import transforms
3230
from elektronn3.inference import Predictor
3331

34-
from training.tifdirdata import UPatches
35-
36-
from models.effnetv2 import effnetv2_s, effnetv2_m
37-
from analysis.cf_matrix import plot_confusion_matrix
32+
from emcaps.analysis.cf_matrix import plot_confusion_matrix
3833

3934
parser = argparse.ArgumentParser(description='Evaluate a network.')
4035
parser.add_argument(

Diff for: inference/seginference.py renamed to emcaps/inference/seginference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from elektronn3.data import transforms
2727

2828

29-
from utils import get_old_enctype, get_v5_enctype, OLDNAMES_TO_V5NAMES, clean_int, ensure_not_inverted, get_meta
29+
from emcaps.utils import get_old_enctype, get_v5_enctype, OLDNAMES_TO_V5NAMES, clean_int, ensure_not_inverted, get_meta
3030

3131

3232
# torch.backends.cudnn.benchmark = True
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: training/patchtrain.py renamed to emcaps/training/patchtrain.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@
4848
import cv2; cv2.setNumThreads(0); cv2.ocl.setUseOpenCL(False)
4949
import albumentations
5050

51-
from training.tifdirdata import EncPatchData
52-
53-
from models.effnetv2 import effnetv2_s, effnetv2_m
54-
55-
import utils
51+
from emcaps.training.tifdirdata import EncPatchData
52+
from emcaps.models.effnetv2 import effnetv2_s, effnetv2_m
53+
from emcaps import utils
5654

5755

5856
parser = argparse.ArgumentParser(description='Train a network.')

Diff for: training/segtrain.py renamed to emcaps/training/segtrain.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151

5252
from tqdm import tqdm
5353

54-
from training.tifdirdata import EncSegData
55-
from utils import V5NAMES_TO_OLDNAMES
54+
from emcaps.training.tifdirdata import EncSegData
55+
from emcaps.utils import V5NAMES_TO_OLDNAMES
5656

5757

5858
# @dataclass
@@ -150,7 +150,7 @@
150150
else:
151151
DATA_SELECTION_V5NAMES = [args.constraintype]
152152

153-
DATA_SELECTION = [V5NAMES_TO_OLDNAMES[n] for n in DATA_SELECTION_V5NAMES]
153+
DATA_SELECTION = [utils.V5NAMES_TO_OLDNAMES[n] for n in DATA_SELECTION_V5NAMES]
154154

155155

156156

Diff for: training/tifdirdata.py renamed to emcaps/training/tifdirdata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from skimage import morphology as sm
1818
from torch.utils import data
1919

20-
import utils
20+
from emcaps import utils
2121

2222
logger = logging.getLogger('elektronn3log')
2323

Diff for: emcaps/utils/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from emcaps.utils.utils import *

Diff for: utils/splitdataset.py renamed to emcaps/utils/splitdataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pandas as pd
1212
from skimage import measure
1313

14-
from utils import get_meta, get_path_prefix, get_image_resources
14+
from emcaps.utils import get_meta, get_path_prefix, get_image_resources
1515

1616

1717
# Load original image sheet

Diff for: utils/utils.py renamed to emcaps/utils/utils.py

File renamed without changes.

Diff for: pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "setuptools-scm"]
3+
build-backend = "setuptools.build_meta"

Diff for: setup.cfg

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[metadata]
2+
name = emcaps
3+
version = 0.1.0
4+
description = Code for the paper Genetically encoded barcodes for correlative volume electron microscopy
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
license = MIT license
8+
classifiers =
9+
Programming Language :: Python :: 3
10+
11+
[options]
12+
packages = find:
13+
zip_safe = True
14+
include_package_data = True
15+
install_requires =
16+
pandas == 1.4.1
17+
18+
[options.entry_points]
19+
console_scripts =
20+
emcaps-seginference = emcaps.inference.inference:main
21+
22+
23+
[options.package_data]
24+
* = README.md, *.yaml

Diff for: setup.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Just for `pip install -e` support until it works without setup.py
2+
3+
from setuptools import setup
4+
5+
setup()

Diff for: utils/__init__.py

-1
This file was deleted.

0 commit comments

Comments
 (0)