mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-04-21 06:10:02 +02:00
This commit is contained in:
parent
f16273a566
commit
894065fe9c
@ -17,7 +17,7 @@ from .CtbRawFile import CtbRawFile
|
|||||||
from .RawFile import RawFile
|
from .RawFile import RawFile
|
||||||
from .ScanParameters import ScanParameters
|
from .ScanParameters import ScanParameters
|
||||||
|
|
||||||
from .utils import random_pixels, random_pixel, flat_list
|
from .utils import random_pixels, random_pixel, flat_list, add_colorbar
|
||||||
|
|
||||||
|
|
||||||
#make functions available in the top level API
|
#make functions available in the top level API
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
||||||
|
|
||||||
def random_pixels(n_pixels, xmin=0, xmax=512, ymin=0, ymax=1024):
|
def random_pixels(n_pixels, xmin=0, xmax=512, ymin=0, ymax=1024):
|
||||||
"""Return a list of random pixels.
|
"""Return a list of random pixels.
|
||||||
@ -25,3 +27,10 @@ def random_pixel(xmin=0, xmax=512, ymin=0, ymax=1024):
|
|||||||
def flat_list(xss):
|
def flat_list(xss):
|
||||||
"""Flatten a list of lists."""
|
"""Flatten a list of lists."""
|
||||||
return [x for xs in xss for x in xs]
|
return [x for xs in xss for x in xs]
|
||||||
|
|
||||||
|
def add_colorbar(ax, im, size="5%", pad=0.05):
|
||||||
|
"""Add a colorbar with the same height as the image."""
|
||||||
|
divider = make_axes_locatable(ax)
|
||||||
|
cax = divider.append_axes("right", size=size, pad=pad)
|
||||||
|
plt.colorbar(im, cax=cax)
|
||||||
|
return ax, im, cax
|
Loading…
x
Reference in New Issue
Block a user