Skip to content

Fix and/or clarify data filename parameter of formPropensitiesGeneral #28

Description

@dmitrisvetlov

Some of the problems can be seen by running the "Designer specification" section of DemoScript.m in the SequentialExperimentDesign branch. There is a dataFilename parameter to the formPropensitiesGeneral method; since the code doesn't document any constraints on this name, I have been using trial-and-error to figure out how best to set this parameter for the SED codes (particularly in the model factory).

Here is the relevant code:

sed = SequentialExperimentDesigner();
sed.DataType = ExperimentalDataType.Empirical;
[~, dataFilename, ~] = fileparts(tempname(pwd));
addpath(genpath('..'));
sed.Model = DiscoverableModelFactory.createModel("GR", dataFilename);

Here is the MATLAB output:

Error using sym/matlabFunction>getOptions (line 812)
The value of 'File' is invalid. It must satisfy the function: isFile.

Error in sym/matlabFunction (line 154)
opts = getOptions(args);
       ^^^^^^^^^^^^^^^^
Error in ssit.Propensity>sym2mFun (line 850)
            exprHandle = matlabFunction(symbolicExpression,'Vars',{states,parameters},'File',fn,'Sparse',false);
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in ssit.Propensity.createAsHybridVec (line 401)
                            sym2mFun(signHybridFactor*expr_x, false, true, nonXTpars(:,1), speciesStoch, [], false, true, prefixNameLocal);
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in SSIT/formPropensitiesGeneral (line 157)
                        ssit.Propensity.createAsHybridVec(sm, obj.stoichiometry,...
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in DiscoverableModelFactory.createModel (line 119)
                    m = m.formPropensitiesGeneral(append(dataFilename,"_S",num2str(ind)),true);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note that I had to make several changes first.

  1. The original line 119 in DiscoverableModelFactory.m utilized array concatenation ([dataFilename,'_S',num2str(ind)]) to create a scalar prefixName. For whatever reason, the elements weren't being concatenated successfully, so I used the append method instead.
  2. Even after that fix, an analogous problem (a non-scalar argument) arose on line 222 in Propensity.m, so I also changed that code to use append (see this commit).
  3. In (randomly) generating my temporary filename, I am also stripping out the path and extension so that no path delimiters are present.

My first guess, reading the error message, is that either no file has been created with the exact filename provided in the call to matlabFunction, or some incorrect value of fn is being passed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is neededquestionFurther information is requested

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions