I just want to confirm what I think I am observing with commands in the python console.
Objective: I would like to record a property - say a weighted mean 207 Corrected Pb206/Pb238 age (and uncertainty) to the properties of a selection group. This will be useful for storing the ages of secondary standards and then accessing them for adding to the footers of data tables.
grp = data.selectionGroup('Z_FCT')
I can't get these to work
grp.property('No. of Selections")
grp.setProperty("Pb7c68Age". 28.4)
I can get these to work
grp.selection(0).property("Duration (s)")
grp.selection(0).setProperty("Pb7c68Age". 28.4)
This leads me to believe that the API doesn't allow group-level property access. The absence of these in the API write-up would suggest that too. I suppose this is a protection against accidentally overwriting a selection property at the group level. The reason to store it as a property is that a weighted mean age might have rejected outliers and therefore differ from the group result.
Age638 = data.groupResult(grp,data.timeSeries(‘Final Pb206/U238 age’)).mean()
This works:
grp = data.selectionGroup('DROM')
for s in grp.selections():
s.setProperty("Pb7c638Age", 28.4)
Pb7c638Age = grp.selection(0).property("Pb7c638Age")
A function might help add the age and uncertainty (global to all selections in group) as well the outlier status (specific to the selection)
def addAgeProperty (group, propDesc, value, unc, outlier)
grp = data.selectionGroup(group)
for idx, s in enumerate(grp.selections()):
s.setProperty(f"Group {propDesc}",value)
s.setProperty(f"Group {propDesc} unc",unc)
s.setProperty(f"Group {propDesc} outlier",outlier[idx])
Or perhaps more generic:
def addGroupProperty (group, propDesc, value)
grp = data.selectionGroup(group)
if len(value) > 1:
for idx, s in enumerate(grp.selections()):
s.setProperty(f"Group {propDesc}",value[idx])
else:
for s in grp.selections():
s.setProperty(f"Group {propDesc}",value)