Hi Joleen -
We spoke about this at our team meeting, and it looks like the reason for the errors is that there are a couple of empty strings at the end of the describe() output. OS X doesn't appear to be handling these empty strings correctly. I wrote this up as
Inquiry 2304.
We found out that a workaround for this is modifying your loop like so:
Code: Select all
l=((describe(diffImg)).split('\n'))
for index, text in enumerate(l):
try:
lin=lin+20
newText=text.replace('::','')
if newText:
panel[0].annotate(newText,line=lin, element=ele,color='yellow', alignment=('right','center'))
except:
pass
We came to the consensus that with a field that includes NaN values from a mask, when this is passed through the describe() function the NaN values shouldn't be included in the histogram output. This matches the other statistical parameters, where if values not contained within the mask's threshold are set to 0 then the 0 values are included in the histogram and other statistical fields like Min and Mode. If the values not contained within the mask's threshold are set to NaN, then the Min/Mode values don't use these NaN values, and neither does the histogram.
We see how this could be confusing to users where if missing values are set to 0 there are included in the histogram, and if they are set to NaN they aren't included. With this in mind, we believe an appropriate thing to do would be to add min/max values of the histogram before/after the histogram to make it easier to interpret. I've added this request, among a couple of others, to
Inquiry 2039. While we believe that these NaN values aren't currently included in the histogram output, I agree that they are included in the 'Length' output.
As for only returning only certain statistical parameters from describe(), here is a way you can do that (without enumerate):
Code: Select all
indices = [0,2,3,5,6,7,8,12,14]
newText = describe(diffImg).split('\n')
for i in indices:
try:
lin = lin + 20
currentLine = newText[i].replace('::','')
if currentLine:
panel[0].annotate(currentLine,line=lin,element=ele,color='yellow',alignment=('right','center'))
except:
pass
These indices correspond to histogram, min, max, q1, q2, q3, iqr, skew, and variance. After speaking with a programmer, we thought that it would be nice to add a keyword to describe() that would allow for selecting which statistical parameters would be returned. This way, a user wouldn't need to be concerned over which index corresponds to a parameter. This is included as part of Inquiry 2039.
Please let me know if this doesn't answer your questions.
Thanks -
Bob