Skip to content

log scale 2D data with zeros and negative values not plotted correctly (Trac #1220) #1249

@pkienzle

Description

@pkienzle

Sasview 4.2

Zero and negative values not plotted appropriately in log scale for 2D data.

Plotter should add invalid values to the mask.

Could instead use a transform something like the following:

data = data.copy()
zmin = min(data[data>0])/2 if (data>0).any() else 1
data[data<=zmin] = zmin
return log10(data)

If you know it is counts data, then log10(data+1) is good enough for visualization.

You may still have a problem with spurious cancellation, for example when looking at background subtracted data, where you might end up with values like 1e-100 while the majority of the values are much higher. Setting the cutoff for masking at 1/2 the 5th percentile, np.quantile(data[data>0], 0.05)/2, instead of min(data[data>0])/2 would be better.

Migrated from http://trac.sasview.org/ticket/1220

{
    "status": "closed",
    "changetime": "2019-03-05T17:33:51",
    "_ts": "2019-03-05 17:33:51.016917+00:00",
    "description": "Sasview 4.2\n\nZero and negative values not plotted appropriately in log scale for 2D data.\n\nPlotter should add invalid values to the mask.\n\nCould instead use a transform something like the following:\n{{{\ndata = data.copy()\nzmin = min(data[data>0])/2 if (data>0).any() else 1\ndata[data<=zmin] = zmin\nreturn log10(data)\n}}}\n\nIf you know it is counts data, then `log10(data+1)` is good enough for visualization.\n\nYou may still have a problem with spurious cancellation, for example when looking at background subtracted data, where you might end up with values like 1e-100 while the majority of the values are much higher.  Setting the cutoff for masking at 1/2 the 5th percentile, `np.quantile(data[data>0], 0.05)/2`, instead of min(data[data>0])/2 would be better.\n",
    "reporter": "pkienzle",
    "cc": "",
    "resolution": "fixed",
    "workpackage": "McSAS Integration Project",
    "time": "2018-12-11T18:18:07",
    "component": "SasView",
    "summary": "log scale 2D data with zeros and negative values not plotted correctly",
    "priority": "major",
    "keywords": "",
    "milestone": "SasView 4.3.0",
    "owner": "GitHub <noreply@github.com>",
    "type": "defect"
}

Metadata

Metadata

Assignees

Labels

DefectBug or undesirable behaviourMajorBig change in the code or important change in behaviourMcSASMcSAS Integration Project

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions