Hi,
My data have only two standard blocks at the beginning and end of my analysis. When I run the 3D trace element DRS, I get messages saying "changing spline type to StepLinear due to fewer than 5 blocks found." Is there a way to override this so I can use WeightedLinearFit?
Thanks,
Cole

  • Joe replied to this.

    mcolebishop

    It looks like there was a hard-coded change to the spline type when there are less than 5 blocks. I've just changed this so that it only overrides the selected spline type if necessary (e.g., you have 2 blocks but have a smoothing spline selected). This change will be in the next release. If you don't want to wait for the next release, you can open the 3d_trace_elements.py file in a plain text editor and search for splineType = 'StepLinear', which should be around line 630, and change StepLinear to WeightedLinearFit (or whichever option you'd like to default to).

    All the best,

    • Joe
      10 days later

      Joe

      Thank you so much! That was really helpful.

      I had another question about the 3D trace elements DRM. When I go to change my affinity in the panel on the right, all of the values for my samples reset to zero. Is there a way to stop this from happening?

        mcolebishop

        Thanks for pointing out that bug. We'll change that in the next release of iolite, but if you want to fix it in the meantime, you can open the 3d_trace_elements.py file in a plain text editor and change Line 1650 from
        sum = 0
        to
        sum = float(s.property('Internal value'))

        Please let us know if you have any questions.

        Kind regards,
        -Bence

          15 days later

          Bence

          Hi Bence,

          Thanks so much again. I had an additional question, is there any way to easily export the weighted means that can be calculated for each group in the results pane?

          Thanks,
          Cole

          Hi Cole,

          There's no easy way of exporting the table in the Results View, but we'll add that for an upcoming release.

          In the meantime, you can use this bit of code to get the same values (paste into Python Workspace and Save As a new file):

          from iolite.QtGui import QFileDialog
          import pandas as pd
          
          # Enter channel to report stats here:
          ch_name = 'Final Pb206/U238'
          
          # Note: This will report the MSWD based on propagated uncertainties only.
          
          # Create new pandas dataframe
          df = pd.DataFrame(columns=['Selection group', 'Count', 'Outliers rejected', 'Average', 'Uncertainty', 'MSWD (prop)'])
          
          # Get channel object
          ch = data.timeSeries(ch_name)
          
          # Assuming you don't want to report stats for the baselines
          # Get Ref Mat and Sample selection groups:
          rm_grps = data.selectionGroupList(data.ReferenceMaterial)
          samp_grps = data.selectionGroupList(data.Sample)
          # Then combine them:
          all_grps = rm_grps + samp_grps
          
          for grp in all_grps:
              # Get group stats. Here's the function signature:
              # stats(TimeSeriesDataPyInterface tsd, str outlierMethodString = "None", str avgTypeString = "Mean", str uncertTypeString = "TwoSDabsolute");
              # Options for outlierMethodString: "None", "TwoSDRejection", "ThreeSDRejection
              # Options for avgTypeString: "Mean", "WeightedMean", "Median"
              # Options for uncertTypeString: "TwoSDabsolute", "TwoSDpercent", "TwoSDppm", "TwoSEabsolute", "TwoSEpercent", "TwoSEppm"
          
              stats = grp.stats(ch, "None", "WeightedMean", "TwoSDabsolute")
          
              # Add to dataframe
              df = df.append({'Selection group': grp.name,
                              'Count': stats['totalResults'],
                              'Outliers rejected': stats['outliers'],
                              'Average': stats['tidyMean'],
                              'Uncertainty': stats['tidyUncert'],
                              'MSWD (prop)': stats['MSWD']},
                              ignore_index=True)
          
          
          # And now ask user where to save the file:
          file_name = QFileDialog.getSaveFileName(None, "Save Group Stats", "Group_stats.csv", "CSV (*.csv)")
          
          # And save out to csv:
          df.to_csv(file_name, index=False)

          Please let us know if you have any troubles.

          Kind regards,
          Bence