Advanced Octave A36 — Public recipes and fit reuse

by Giux GX-TXT, octave-en, scripts-en 3 min read

Advanced GNU Octave with GX-TXT · Module 06

A recipe describes a accepted fit so that you can control dependencies and explicitly request a new execution. Acquisition, validation and re-execution are distinct operations.

Objectives and prerequisites

We start from a linear fit accepted in the Curve Fitter on the Synthetic Dataset octave_advanced_batch_a of lesson A14. We already know fit and Session from the introductory course. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0.

In the Curve Fitter we selected time_s time and signal_v signal, created the linear preview, accepted the fit and saved the Workspace. idoc_7899510237316669 and accepted1 IDs belong to this specific Session: they are not universal identifiers. To adapt the script to your Session you need the actual identifiers of the Workspace and the accepted fit, obtained from the public tools available in your version.

Purchasing and validating

Import valida_recipe.m, replace IDs with those corresponding to your Session, record the script and start it in the Runner.

api = 'DATASET_CURVE_FIT_API_v1';
recipe = gxtxt_api_call(api,'recipe_capture',{doc,fit_id});
validation = gxtxt_api_call(api,'recipe_validate',{recipe});
disp(validation);

recipe_capture acquires an encoded description of the accepted fit. recipe_validate controls the dependencies and information required by the contract without rethinking the estimate.

In our test the validation returns status = validated, model linear and acquired fit accepted1. Validation is not the re-enforcement of the fit and does not guarantee that the conditions remain valid if source or version changes.

Restore a recipe

The public contract includes recipe_run with the recipe and a Workspace name to perform the analysis again and return a reference to the result. It is a separate action from the simple reading of the previous result. Before reusing a recipe always checks source, model, version, unit and validation status.

Note on the version. In the dev112-P011-bis copy used for driving, acquisition and validation were successful, but two recipe_run attempts, even after the closure of the Curve Fitter, returned Session Workspace database already has an active writer or invalid lock. A screenshot of a successful rerun is not available. The expected behavior is to create the new result when the recipe is valid and the Workspace can be updated. The version in which the problem will be correct has not been verified. The small playback script retains the observed call and uses the IDs of the sample session.

Exercise

  1. Does the validation again fit?
  2. Why should the script IDs be adapted to another Session?
  3. Is it correct to declare successful re-execution if recipe_run signals an error?

Worked solution

  1. No. Check the conditions provided by the recipe without re-evaluating the estimate.
  2. They identify a Workspace and a fit accepted in the Test Session.
  3. No. The error must be reported and the re-execution should not be presented as a success.

Download the Module 06 scripts (ZIP)

#GNU Octave #GX-TXT #GX-TXT public APIs

Other steps of this project

Leave a Reply

Your email address will not be published. Required fields are marked *