ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
readSample.m
Go to the documentation of this file.
1%> \brief
2%> Return a list of objects of superclass [pm.sampling.FileContentsSample](@ref FileContentsSample)
3%> containing the content(s) of the ParaMonte simulation output sample
4%> file(s) whose path(s) match the specified input ``pattern`` or the
5%> simulation specification ``sampler.spec.outputFileName``.<br>
6%>
7%> \warning
8%> This method is to be only used for post-processing of the
9%> output sample file(s) of an already finished simulation.<br>
10%> Although possible, this method is NOT meant to be called
11%> by all processes in MPI-parallel simulations.<br>
12%>
13%> \param[in] self : The input parent object of class [pm.sampling.Sampler](@ref Sampler)
14%> which is **implicitly** passed to this dynamic method (not by the user).<br>
15%> \param[in] pattern : The input scalar MATLAB string containing the pattern matching
16%> the desired sample file(s) whose contents is to be read.<br>
17%> The specified ``pattern`` only needs to partially identify
18%> the name of the simulation to which the sample file belongs.<br>
19%> For example, specifying ``"./mydir/mysim"`` as input will
20%> lead to a search for file(s) beginning with "mysim" and
21%> ending with ``"_sample.txt"`` inside the directory ``"./mydir/"``.<br>
22%> If there are multiple files matching in the input ``pattern``,
23%> then all such files will be read and returned as elements of a list.<br>
24%> If the specified pattern is a valid existing URL, the file will be
25%> downloaded as a temporary file to the local system, its contents
26%> shall be parsed and the file will be subsequently removed.<br>
27%> If the input ``pattern`` is empty, then the method will search
28%> for any possible candidate files with the appropriate suffix
29%> in the current working directory.<br>
30%> (**optional**, default = ``sampler.spec.outputFileName`` or ``"./"``)
31%>
32%> \param[in] sep : The input MATLAB string containing the field separator used in the file(s).<br>
33%> (**optional**, default = ``sampler.spec.outputSeparator`` or automatically inferred.)
34%>
35%> \return
36%> ``sampleList`` : The output MATLAB cell array of objects
37%> of class [pm.sampling.FileContentsSample](@ref FileContentsSample),
38%> each of which corresponds to the contents
39%> of a unique sample file.<br>
40%>
41%> \interface{readSample}
42%> \code{.m}
43%>
44%> sampler = pm.sampling.Sampler();
45%> sampleList = sampler.readSample();
46%> sampleList = sampler.readSample([]);
47%> sampleList = sampler.readSample([], []);
48%> sampleList = sampler.readSample(pattern);
49%> sampleList = sampler.readSample([], sep);
50%> sampleList = sampler.readSample(pattern, sep);
51%>
52%> \endcode
53%>
54%> \note
55%> See the documentation of the subclasses of [pm.sampling.Sampler](@ref Sampler)
56%> (e.g., [pm.sampling.Paradram](@ref Paradram)) for example usage in action.<br>
57%>
58%> \example{readSample}
59%> \code{.m}
60%>
61%> sampler.readSample("./out/test_run_");
62%>
63%> sampler.spec.outputFileName = "./out/test_run_";
64%> sampler.readSample();
65%>
66%> sampler.readSample("./out/test_run_", ",");
67%>
68%> sampler.spec.outputSeparator = ",";
69%> sampler.readSample("./out/test_run_");
70%>
71%> sampler.spec.outputFileName = "./out/test_run_";
72%> sampler.spec.outputSeparator = ",";
73%> sampler.readSample();
74%>
75%> \endcode
76%>
77%> \final{readSample}
78%>
79%> \author
80%> \JoshuaOsborne, May 21 2024, 12:38 AM, University of Texas at Arlington<br>
81%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
82%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
83function sampleList = readSample(self, pattern, sep)
84
85 if nargin < 3
86 sep = [];
87 end
88
89 if nargin < 2
90 pattern = [];
91 end
92
93 sampleList = pm.sampling.readSample(self, pattern, sep);
94
95end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
This is the base class for generating objects that contain the contents of a sample/chain file genera...
This is the ParaDRAM class for generating instances of serial and parallel Delayed-Rejection Adaptive...
Definition: Paradram.m:18
This is the base class for the ParaMonte sampler routines.
Definition: Sampler.m:21
function parallel()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function readSample(in sampler, in pattern, in sep)
Return a list of objects of superclass pm.sampling.FileContentsSample containing the contents of a (s...
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...