Opened 5 weeks ago

Last modified 5 weeks ago

#1220 new defect

log scale 2D data with zeros and negative values not plotted correctly

Reported by: pkienzle Owned by:
Priority: major Milestone: SasView 4.3.0
Component: SasView Keywords:
Cc: Work Package: McSAS Integration Project

Description

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 ½ the 5th percentile, np.quantile(data[data>0], 0.05)/2, instead of min(data[data>0])/2 would be better.

Change History (2)

comment:1 Changed 5 weeks ago by krzywon

In sasgui/plottools/PlotPanel.py, lines 1460 and 1469 that handle negative values for log plotting are commented out. Removing the comments makes the plots look much better.

The percentile suggestion will take some extra work to handle values between 0 and 1 (log10(1<n<0) is a negative number).

comment:2 Changed 5 weeks ago by pkienzle

See sasview PR #202.

This uses the min(data>0) as the cutoff rather than the 5th percentile, but it includes a note on how to change from one to the other.

Note: See TracTickets for help on using tickets.