Difference between revisions of "Particle File List"

From Dynamo
Jump to navigation Jump to search
Line 1: Line 1:
 
The Particle File List is a [[Generic data containers | generic data container]] that can be used an alternative for [[classic ''Dynamo'' data folders | Data folder]].  
 
The Particle File List is a [[Generic data containers | generic data container]] that can be used an alternative for [[classic ''Dynamo'' data folders | Data folder]].  
 
This object  contains a list of tags and a list of particle  files, both lists having equal length.Thus, the ''tag'' of. a file is defined by the value of  <tt>tag</tt> property inside the object, '''not''' by the name of particle file (unlike in a classic Dynamo folder).
 
This object  contains a list of tags and a list of particle  files, both lists having equal length.Thus, the ''tag'' of. a file is defined by the value of  <tt>tag</tt> property inside the object, '''not''' by the name of particle file (unlike in a classic Dynamo folder).
The <tt>ParticleListFile</tt> object is just a wrapper on a list of files,  
+
The <tt>ParticleListFile</tt> object is just a wrapper on a list of files: the particle files still need to be stored somewhere. They can be stored in any ''Dynamo'' storage folder (as classical ''Dynamo'' folders or [['dBox folder | 'dBoxes folders'' ]] ), but this restriction is not necessary. Any
  
 
= When to use it =
 
= When to use it =
Line 7: Line 7:
 
= Converting old data folders =  
 
= Converting old data folders =  
  
dpkdata.containers.ParticleListFile.data2starFile(<data>,<star file>);
+
== Converting one single data folder ==
 +
 
 +
You can get a file representing a <tt>ParticleFileList</tt> object simply with the command:
 +
<tt>dpkdata.containers.ParticleListFile.data2starFile(<data>,<star file>);</tt>
 +
 
 +
This file can be used as input for  <tt>average</tt> or an alignment project. You can use a <tt>table</tt> flag in order to pass a table.
 +
With this format, the tags of the particles are not changed.
 +
 
 +
== Merging several data folders ==
 +
 
 +
The command for this functionality is:
 +
<tt>dpkdata.containers.ParticleListFile.mergeDataFolders</tt>
 +
which is be fed with a cell array of names of data folders. Here, you can pass along a cell array of tables (one per data folder) using the flag <tt>table</tt>
  
 
= Example of use =
 
= Example of use =
Line 15: Line 27:
  
 
It creates three classical data folders, each with its own 8 particles, and a table to refer them. This table contains the actual alignment parameters of the particles in the respective data folder.
 
It creates three classical data folders, each with its own 8 particles, and a table to refer them. This table contains the actual alignment parameters of the particles in the respective data folder.
 +
All particles of all files are indexed into a single new object that keeps track of data folders and tables, renaming the tags coherently. Note that initial particle files are not moved or copied; the new object just references them. In this example, it is fed into <tt>average</tt>, but if can be input into a project (after saving the object into a <tt>star</tt> file).
  
  
  <code>% create three different data folders
+
  <nowiki>% create three different data folders
 
N = 3;
 
N = 3;
 
testNameRoot = 'testFolder';
 
testNameRoot = 'testFolder';
Line 48: Line 61:
  
 
% computes the average in the classical way
 
% computes the average in the classical way
ws = daverage(plf,'t',tMerged); </code>
+
ws = daverage(plf,'t',tMerged); </nowki>

Revision as of 17:16, 30 September 2019

The Particle File List is a generic data container that can be used an alternative for Data folder. This object contains a list of tags and a list of particle files, both lists having equal length.Thus, the tag of. a file is defined by the value of tag property inside the object, not by the name of particle file (unlike in a classic Dynamo folder). The ParticleListFile object is just a wrapper on a list of files: the particle files still need to be stored somewhere. They can be stored in any Dynamo storage folder (as classical Dynamo folders or 'dBoxes folders ), but this restriction is not necessary. Any

When to use it

Converting old data folders

Converting one single data folder

You can get a file representing a ParticleFileList object simply with the command:

dpkdata.containers.ParticleListFile.data2starFile(,<star file>);

This file can be used as input for average or an alignment project. You can use a table flag in order to pass a table. With this format, the tags of the particles are not changed.

Merging several data folders

The command for this functionality is:

dpkdata.containers.ParticleListFile.mergeDataFolders
which is be fed with a cell array of names of data folders. Here, you can pass along a cell array of tables (one per data folder) using the flag table

Example of use

The script below is In your Dynamo distribution under

dpkdata.examples.setOfDataFoldersIntoParticleListFile.

It creates three classical data folders, each with its own 8 particles, and a table to refer them. This table contains the actual alignment parameters of the particles in the respective data folder. All particles of all files are indexed into a single new object that keeps track of data folders and tables, renaming the tags coherently. Note that initial particle files are not moved or copied; the new object just references them. In this example, it is fed into average, but if can be input into a project (after saving the object into a star file).


<nowiki>% create three different data folders

N = 3; testNameRoot = 'testFolder'; for i=1:N

  testName{i} = sprintf('%s%03d',testNameRoot,i)
  
  % each folder has the same particle tags (1 to 8), but the same 
  % tag on each folder is a different particle
  dynamo_tutorial(testName{i},'real_random',1,'linear_tags',1); 

end

%% % keeps the positions of data and tables for i=1:N

  dataname{i}  = mbparse.files.absolutePath.getAbsolutePath([testName{i},filesep,'/data']);
  tableName{i} = mbparse.files.absolutePath.getAbsolutePath([testName{i},filesep,'/real.tbl']);

end

% % merges all data folders into one single ParticleListFile object %

% we can pass a table attached to each data folder plf = dpkdata.containers.ParticleListFile.mergeDataFolders(dataname,'tables',tablename);

% The storage object keeps track of the accumulated metadata

% gets a table of the old Dynamo style (just a matrix of numbers) tMerged = plf.metadata.table.getClassicalTable();

% computes the average in the classical way ws = daverage(plf,'t',tMerged); </nowki>