mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-05 04:58:11 +08:00
Allow float64 to down-cast to float32 (#472)
* warn if annotations will down-cast to float32 * correctly handle falsey data values
This commit is contained in:
@@ -34,7 +34,7 @@ class HistogramBrush extends React.Component {
|
|||||||
.scaleLinear()
|
.scaleLinear()
|
||||||
.range([this.height - this.marginBottom, 0]);
|
.range([this.height - this.marginBottom, 0]);
|
||||||
|
|
||||||
if (obsAnnotations[0][field]) {
|
if (obsAnnotations[0][field] !== undefined) {
|
||||||
// recalculate expensive stuff
|
// recalculate expensive stuff
|
||||||
const allValuesForContinuousFieldAsArray = _.map(obsAnnotations, field);
|
const allValuesForContinuousFieldAsArray = _.map(obsAnnotations, field);
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ class ScanpyEngine(CXGDriver):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _can_cast_to_float32(ann):
|
def _can_cast_to_float32(ann):
|
||||||
if ann.dtype.kind == "f" and np.can_cast(ann.dtype, np.float32):
|
if ann.dtype.kind == "f":
|
||||||
|
if not np.can_cast(ann.dtype, np.float32):
|
||||||
|
warnings.warn(f"Annotation {ann.name} will be converted to 32 bit float and may loose precision.")
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user