Working with files

As of version 5 of the PalmSens SDK and PSTrace measurements and their corresponding methods are stored in .pssession files.
Methods can be stored separately in .psmethod files.

The PalmSens SDK is backwards compatible with following (legacy) filetypes:

  vs potential (scan method) Measurement vs time
Method file .pms .pmt
Data (single curve) file .pss .pst
Analysis curves file .psd  
Multiplexer curves file   .mux

Loading a method file (.psmethod)

In order to use the following examples, make sure the PalmSens.Core.dll and PalmSens.Core.Windows.dll are added as references in your project.
For the examples using the Simplified Core wrapper the PalmSens.Core.Simplified.csproj and PalmSens.Core.Simplified.WPF.csproj must also be referenced.

To load a method .psmethod file from the specified String filepath (i.e. “C:\\YourMethod.psmethod”):

Using Simplified PalmSens.Core:

using PalmSens; 
using PalmSens.Core.Simplified.WPF;

Add these namespaces at the top of the document.

Method method = SimpleLoadSaveFunctions.LoadMethod(filepath);

Using PalmSens.Core:

using PalmSens; 
using PalmSens.Windows;

Add these namespaces at the top of the document.

Method method = LoadSaveHelperFunctions.LoadMethod(filepath);

Setting up a method

The next example defines a Linear Sweep Voltammetry method with the same parameters shown in the table on the previous page.

Example:

using PalmSens;
using PalmSens.Techniques;

Add these namespaces at the top of the document.

LinearSweep lsv = new LinearSweep();
lsv.BeginPotential = -1f;
lsv.EndPotential = 1f;
lsv.StepPotential = 0.01f;
lsv.Scanrate = 1f;

//Define the method’s parameters.
lsv.Ranging.StartCurrentRange = new CurrentRange(3); //1 µA
lsv.Ranging.MaximumCurrentRange = new CurrentRange(4); // 10 µA
lsv.Ranging.MaximumCurrentRange = new CurrentRange(-1); // 100 pA

Define the current range settings. The CurrentRange constructor uses an integer to specify it’s range:
-1 = 100 pA
0 = 1 nA
1 = 10 nA
2 = 100 nA
3 = 1 uA
4 = 10 uA
5 = 100 uA
6 = 1 mA
7 = 10 mA
8 = 100 mA

Saving a method

To save the Linear Sweep Voltammetry method with the parameters as defined in the previous example, the following examples can be used.
This saves the previously defined Linear Sweep Voltammetry method (LSV) to a .psmethod file specified in the String filepath (i.e. “C:\\YourMethod.psmethod”).

Using Simplified PalmSens.Core: 

using PalmSens; 
using PalmSens.Core.Simplified.WPF;

Add these namespaces at the top of the document.

SimpleLoadSaveFunctions.SaveMethod(lsv, filepath);

Using PalmSens.Core:

using PalmSens; 
using PalmSens.Windows;

Add these namespaces at the top of the document.

LoadSaveHelperFunctions.SaveMethod(lsv, filepath);

Loading and saving data

Data from measurements can be loaded from and stored to .pssession files. This contains a session with one or more measurements containing its respective method and curves.

Loading measurements from .pssession file a is done as following.

The simplified wrapper for the PalmSens.Core libraries uses the SimpleMeasurement and SimpleCurve classes from the PalmSens.Core.Simplified.Data namespace instead of the PalmSens.MeasurementPalmSens.Plottables.Curve and PalmSens.Plottables.EISData classes. The SimpleMeasurement and SimpleCurve classes make it easier to perform basic functions such as:

  • Creating a curve with different units from a measurement (for example a curve with charge over time).
  • Finding peaks in a curve.
  • Determining the moving average baseline of a curve.
  • Performing basic operations on a curve (Addition, Subtraction, Multiplication, Log10, Differentiation, Integration).

The following code saves a SimpleMeasurement to a .pssession file specified in the String filepath (i.e. “C:\\YourData.pssession”):

Using Simplified PalmSens.Core: 

using PalmSens;
using PalmSens.Core.Simplified.Data;
using PalmSens.Core.Simplified.WPF;

Add these namespaces at the top of the document.

SimpleLoadSaveFunctions.SaveMeasurement(measurement, filepath);

Using PalmSens.Core:

The following code saves a measurement (PalmSens.Measurement class) to a .pssession file specified in the String filepath (i.e. “C:\\some location\\YourData.pssession”):

using PalmSens;
using PalmSens.Data;
using PalmSens.Windows;

Add these namespaces at the top of the document.

SessionManager session = new SessionManager();
session.AddMeasurement(measurement);
LoadSaveHelperFunctions.SaveSessionFile(filepath, session);