Hi all,
This thread will provide more details about the new pipeline script introduced with WBPP 2.5.
The script can be enabled under the Pipeline tab:
The WBPP pipeline execution flow is depicted in the following flow chart:
As shown, the pipeline script is invoked each time a trackable operation starts and ends. The list of trackable operations is the following:
Depending on the operation, more information may be available in the env object. The following list provides more details for each operation:
The env.status property assumes the values defined by the OperationBlockStatus object; in particular, the following are possible:
Below, an example of a simple script that prints the current operation and the number of frames involved:
By printing to the console, the output of this script can be read in the log file. Here are some samples extracted from a log file:
In a more advanced example, we could run bash commands to integrate WBPP with virtually any system:
This thread will provide more details about the new pipeline script introduced with WBPP 2.5.
The script can be enabled under the Pipeline tab:
The WBPP pipeline execution flow is depicted in the following flow chart:
As shown, the pipeline script is invoked each time a trackable operation starts and ends. The list of trackable operations is the following:
- Calibration
- LPS-LDD
- Cosmetic Correction
- Debayer
- Measurements
- Weights generation
- Bad frames rejection
- Writing weights
- Reference frames selection
- Plate solving reference frames
- Registration
- Local normalization reference frame generation (both automated or interactive mode)
- Local normalization
- Integration
- Drizzle Integration
- RGB Recombination
- It is invoked within a dedicated scope: each local variable will run out of scope after its execution.
- It should be stateless: avoid trying to persist information by modifying/injecting data into any existing object, even if it's accessible from the scope code.
- The script code runs within a try/catch block to protect the execution integrity, so it is safe to raise an exception to terminate the script operation.
- Any information about the operation is embedded into an injected variable env; use it to retrieve any information about the operation.
- env.event [String ]: the operation event that triggered the script. IT could be "start" or "done"
- env.operationsCount [Number ]: the total number of operations in the pipeline
- env.operationIndex [Number ]: the zero-based index of the current operation
Depending on the operation, more information may be available in the env object. The following list provides more details for each operation:
Operation | env.name | properties of env object |
Calibration | "Calibration" | .name .status .statusMessage [Group information] |
LPS+LDD | "LPS" | .name .status .statusMessage |
Cosmetic correction | "Cosmetic Correction" | .name .status .statusMessage [Group information] |
Debayer | "Debayer" | .name .status .statusMessage [Group information] |
Measurements | "Measurements" | .name .status .statusMessage |
Weights generation | "Weights generation" | .name .status .statusMessage |
Bad frames rejection | "Bad frames rejection" | .name .status .statusMessage |
Weights writing | "Write weights" | .name .status .statusMessage |
Reference frame selection | "Reference frame selection" | .name .status .statusMessage |
Plate solving | "Plate solving reference frames" | .name .status .statusMessage |
Registration | "Registration" | .name .status .statusMessage [Group information] |
Local Normalization reference frame selection | "LN reference generation" | .name .status .statusMessage [Group information] |
Local Normalization reference frame selection [interactive] | "LN reference [interactive]" | .name .status .statusMessage [Group information] |
Local Normalization | "Local Normalization" | .name .status .statusMessage [Group information] |
Image Integration | "Integration" | .name .status .statusMessage [Group information] |
Drizzle Integration | "Drizzle Integration" | .name .status .statusMessage [Group information] |
RGB channel recombination | "RGB Combination" | .name .status .statusMessage [Group information] |
The env.status property assumes the values defined by the OperationBlockStatus object; in particular, the following are possible:
- OperationBlockStatus.RUNNING = 1: the operation is started
- OperationBlockStatus.DONE = 2: the operation terminated successfully
- OperationBlockStatus.FAILED = 3: the operation failed
- OperationBlockStatus.CANCELED = 4; the operation has been canceled
- env.group.size [String]: string size in the format [width]x[height]
- env.group.binning [Number]: the group binning
- env.group.filter [String]: the filter name
- env.group.exposure [Number]: the group exposure reference
- env.group.color[String]: the group color space, it can be
- "Mono" for monochromatic
- "CFA" for bayered images in calibration mode
- "RGB" for debayered images in post-calibration mode
- env.group.mode [String]: the group mode, it could be "calibration" or "post-calibration"
- env.group.channel[String]: non empty string indicates that the group belongs to an associated channel, in particular
- "_R", "_G", _B": separated gray channel group
- "combined RGB": the rgb recombination group
- env.group.keywords [Object]: a map between the keywords name and the value associated to the group
- env.group.frames[Array]: an array listing the active frames. An active frame is an object with the following relevant properties
- current [String]: the filepath of the last associated file in the file history. Each time a file item is processed, the resulting output file is associated with the file item as the "current" one. For example, after the calibration, the calibrated file is associated with the file item as the "current" and this property will point to the calibrated file path. Once this file item is debayered, the debayered file will be set as the new "current" file and this property will point to the debayered file path.
- descriptor[Object]: a descriptor contains the measurements of the file; the list or properties is the following:
- FWHM
- eccentricity
- noise
- numberOFStars
- PSFSignalWeight
- PSFSNR
- SNR
- median
- mad
- Mstar
- localNormalizationFile [String]: the path of the associated local normalization file
- drizzleFile [String]: the path of the associated drizzle file
- isReference [Boolean]: true if the file item is a reference for star alignment
Below, an example of a simple script that prints the current operation and the number of frames involved:
JavaScript:
if (env.event == "start") {
console.noteln("[SCRIPT LOG] Operation ", env.name, " started");
if (env.group) {
console.writeln("[SCRIPT LOG] processing " + env.group.frames.length +" frames");
}
}
if (env.event == "done") {
if (env.status == OperationBlockStatus.DONE)
console.noteln("[SCRIPT LOG] ", env.name, " successfully executed");
else if (env.status == OperationBlockStatus.FAILED)
console.noteln("[SCRIPT LOG] ", env.name, " failed, " + env.statusMessage);
else if (env.status == OperationBlockStatus.CENELED)
console.noteln("[SCRIPT LOG] ", env.name, " canceled");
}
By printing to the console, the output of this script can be read in the log file. Here are some samples extracted from a log file:
In a more advanced example, we could run bash commands to integrate WBPP with virtually any system:
JavaScript:
let say = function(sentence) {
// spd-say is a text to speech command
ExternalProcess.execute( "spd-say", ["-w", sentence]);
sleep(1);
}
if (env.event == "start") {
say(env.name)
if (env.group) {
say("processing " + env.group.frames.length +" frames");
}
}
if (env.event == "done") {
if (env.status == OperationBlockStatus.DONE)
say(env.name + " successfully executed");
else
if (env.status == OperationBlockStatus.FAILED)
say(env.name + "failed, " + env.statusMessage);
}
Attachments
Last edited: