Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
din14970 committed Sep 10, 2020
1 parent 00ca68c commit a031975
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="temmeta",
version="0.0.4",
version="0.0.6",
description=("TEMMETA is a library for transmission electron microscopy "
"(TEM) (meta)data manipulation"),
url='https://github.com/din14970/TEMMETA',
Expand All @@ -27,12 +27,9 @@
'openpyxl',
'pandas',
'scipy',
'jupyter',
'hyperspy',
'matplotlib_scalebar',
'tqdm',
'Pillow',
'opencv-python',
'PyQt5'
],
)
11 changes: 11 additions & 0 deletions temmeta/algebrautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ def distance(x1, y1, x2, y2):
"""Get the euclidian distance between two points"""
le = np.sqrt((x2-x1)**2+(y2-y1)**2)
return le


def get_center_and_radius(x1, y1, x2, y2, x3, y3):
"""Get the coordinates of the center and radius of
a circle defined by 3 points p_i=(x_i, y_i)"""
cx = (((x1**2-x3**2+y1**2-y3**2)*(y2-y1) -
(x1**2-x2**2+y1**2-y2**2)*(y3-y1)) /
(2*((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))))
cy = (-(x1**2-x2**2+y1**2-y2**2)-2*(x2-x1)*cx)/(2*(y2-y1))
r = ((x1-cx)**2+(y1-cy)**2)**0.5
return (cx, cy), r
24 changes: 11 additions & 13 deletions temmeta/data_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
from PIL import Image

# My own modules
from . import plottingtools as pl
from . import image_filters as imf
from ._decorators import timeit
from .guitools import file_dialog as fdo
from . import processing as proc
from . import metadata as mda
from . import jsontools as jt
from . import algebrautils as algutil
from .roi import line
from temmeta import plottingtools as pl
from temmeta import image_filters as imf
from temmeta._decorators import timeit
from temmeta.guitools import file_dialog as fdo
from temmeta import processing as proc
from temmeta import metadata as mda
from temmeta import jsontools as jt
from temmeta import algebrautils as algutil
from temmeta.roi import line

import concurrent.futures as cf
from multiprocessing import Pool, cpu_count
Expand Down Expand Up @@ -3188,13 +3188,11 @@ def get_frame(self, frame_index):
process)
return nimg

@property
def average(self):
"""Average the frames, return GeneralImage object"""
# Sum becomes a uint64 image
dt = self.data.dtype
data = self.data.sum(axis=0)
# Rescale to turn it back into the same datatype as before
data = imf.normalize_convert(data, dtype=dt)
data = self.data.mean(axis=0)
process = "Averaged all frames in stack"
nimg = create_new_image(data, self.pixelsize, self.pixelunit, self,
process)
Expand Down
Empty file added temmeta/roi/__init__.py
Empty file.

0 comments on commit a031975

Please sign in to comment.