Comments (3)
Thanks @mpmdean . We are working on code for one big PR for various issues. For others that run into this prroblem, you may use the work around below by setting half=True
.
import logging
logger = logging.getLogger(__name__)
import numpy as np
from csxtools.image import rotate90, stackmean
from csxtools.utils import calculate_flatfield, get_images_to_3D, get_fastccd_images
def get_fastccd_flatfield(light, dark, flat=None, limits=(0.6, 1.4), half=False, half_args = (7, 486)):
"""MODIFIED from csxtools original: Calculate a flatfield
This routine calculates the flatfield using the
:func:calculate_flatfield() function after obtaining the images from
the headers.
Parameters
----------
light : databroker header
The header containing the light images
dark : databroker header
The header from the run containin the dark images
flat : flatfield image (optional)
The array to be used for the initial flatfield
half : calculate for just the "good" half - hard coded
Default is False
half_args : Tuple for exluding entire sides of detector (left versus right)
Left side is refers the the left side of the image after raw data is
processed with get_fastccd_images(). Default arguments are for the left side
using the FrameStore mode.
Returns
-------
array_like
Flatfield correction
"""
images = get_images_to_3D(get_fastccd_images(light, dark, flat))
images = stackmean(images)
if half == True:
#rows because "super columns" are the large 10 pixel bins, but camera is on side.
row_start, row_stop = half_args
images[:,row_start:row_stop] = np.nan
#plt.figure()
#im = plt.imshow(images, vmin =0, vmax = 500)
#cbar = plt.colorbar(im)
#cbar.set_label('ADU gain corrected')
flat = calculate_flatfield(images, limits)
removed = np.sum(np.isnan(flat))
if removed != 0:
logger.warning("Flatfield correction removed %d pixels (%.2f %%)" %
(removed, removed * 100 / flat.size))
return flat
from csxtools.
Issue #77 covers this
from csxtools.
I didn't spot that prior version of the same issue. I think this can be closed.
from csxtools.
Related Issues (20)
- make csx tools load multiple scan_ids HOT 6
- image_stack_to_movie is broken HOT 1
- get_fastccd_images cannot process all instances of recorded data HOT 2
- roi argument for get_fastccd_images() is broken ... plus some flatfield dependency discussion HOT 23
- KeyError: 'AD_HDF5' for 1.14 for get_fastccd_flatfield() and get_fastccd_images() HOT 7
- Should we change default behavior get_fastccd_images to use a flatfield of (almost) all ones? HOT 3
- get_fastccd_images() does not work with roi given as input HOT 3
- swmr says it is enabled but it doesn't seem to work HOT 1
- Strange error related to dark image scan with x2 gain HOT 3
- Logging module no longer works
- fccd flatfield function doesn't handle the broken part of the camera very well HOT 5
- Remove hard-coded rows and columns because this changes HOT 1
- Potential place for controlling dark image searching HOT 1
- conda packaging for Python 3.10 HOT 2
- Fix deprecation warnings on tests. HOT 6
- ENH more automation of flatfield correction HOT 1
- homework for new helpers modules HOT 1
- helpers.overscan copy-paste error for right-side of detector
- flake8 style needed for new modules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csxtools.