How to export the "Average Traces" from spectrum to script block?
Quote from David3542 on 15/05/2022, 09:02Hi
This is an spectrum view
How is possible to use ( or export ) the "Average Traces " to script block for do some other proceed ?
And also you can see many Traces in Spectrum View , Max hold , Average and...
is it possible to do some arithmetic between them ? for example plot MAX HOLD + AVERAGE or something else ?
Hi
This is an spectrum view
How is possible to use ( or export ) the "Average Traces " to script block for do some other proceed ?
And also you can see many Traces in Spectrum View , Max hold , Average and...
is it possible to do some arithmetic between them ? for example plot MAX HOLD + AVERAGE or something else ?
Quote from mm_dev on 16/05/2022, 09:55You can get the Average trace in the script block by adding a DSP processing block of type "Average" and connect it to the script blocks input, then the script block will convert "raw" spectra data fed into its input into a stream of averaged samples at its output:
(there are also other processing blocks like MinHold or MaxHold, see https://v6-forum.aaronia.de/forum/topic/rtsa-suite-pro-java-script-support/ for a list)
import { DSPStream } from "dspstream.js";
// function receives the result of the "Average" processing block and simply forwards it to the script block output
function onPacket(flags, meta, samples) {
let packet = meta;
packet.samples = samples();
DSPStream.sendPacket(0, packet);
}async function init() {
DSPStream.addBlocks({avg: { type: "Average", config: { avgsamples: 10000, avgpower: true }}).then(() => {
return DSPStream.connectBlocks([{ source: "in0", drain: "avg" }, { source: "avg", drain: "script", input: "in0" }]);
}).then(() => {
DSPStream.receivePackets(0, onPacket);
});
}function main() {
}init().then(() => {
main();
});
You can get the Average trace in the script block by adding a DSP processing block of type "Average" and connect it to the script blocks input, then the script block will convert "raw" spectra data fed into its input into a stream of averaged samples at its output:
(there are also other processing blocks like MinHold or MaxHold, see https://v6-forum.aaronia.de/forum/topic/rtsa-suite-pro-java-script-support/ for a list)
import { DSPStream } from "dspstream.js";
// function receives the result of the "Average" processing block and simply forwards it to the script block output
function onPacket(flags, meta, samples) {
let packet = meta;
packet.samples = samples();
DSPStream.sendPacket(0, packet);
}async function init() {
DSPStream.addBlocks({avg: { type: "Average", config: { avgsamples: 10000, avgpower: true }}).then(() => {
return DSPStream.connectBlocks([{ source: "in0", drain: "avg" }, { source: "avg", drain: "script", input: "in0" }]);
}).then(() => {
DSPStream.receivePackets(0, onPacket);
});
}function main() {
}init().then(() => {
main();
});
Quote from mm_dev on 16/05/2022, 09:58Quote from David3542 on 15/05/2022, 09:02And also you can see many Traces in Spectrum View , Max hold , Average and...
is it possible to do some arithmetic between them ? for example plot MAX HOLD + AVERAGE or something else ?
There is the "Binary Arithmetic" block for that.
Quote from David3542 on 15/05/2022, 09:02And also you can see many Traces in Spectrum View , Max hold , Average and...
is it possible to do some arithmetic between them ? for example plot MAX HOLD + AVERAGE or something else ?
There is the "Binary Arithmetic" block for that.
Quote from David3542 on 16/05/2022, 14:39Quote from mm_dev on 16/05/2022, 09:55You can get the Average trace in the script block by adding a DSP processing block of type "Average" and connect it to the script blocks input, then the script block will convert "raw" spectra data fed into its input into a stream of averaged samples at its output:
(there are also other processing blocks like MinHold or MaxHold, see https://v6-forum.aaronia.de/forum/topic/rtsa-suite-pro-java-script-support/ for a list)
import { DSPStream } from "dspstream.js";
// function receives the result of the "Average" processing block and simply forwards it to the script block output
function onPacket(flags, meta, samples) {
let packet = meta;
packet.samples = samples();
DSPStream.sendPacket(0, packet);
}async function init() {
DSPStream.addBlocks({avg: { type: "Average" }}).then(() => {
return DSPStream.connectBlocks([{ source: "in0", drain: "avg" }, { source: "avg", drain: "script", input: "in0" }]);
}).then(() => {
DSPStream.receivePackets(0, onPacket);
});
}function main() {
}init().then(() => {
main();
});
Thank you for your reply
in the spectrum , Average trace has some good setting
When we use this trace with DSP processing Block, then is it possible to do this setting ?
could you please add this setting in your example code ?
Thanks
Quote from mm_dev on 16/05/2022, 09:55You can get the Average trace in the script block by adding a DSP processing block of type "Average" and connect it to the script blocks input, then the script block will convert "raw" spectra data fed into its input into a stream of averaged samples at its output:
(there are also other processing blocks like MinHold or MaxHold, see https://v6-forum.aaronia.de/forum/topic/rtsa-suite-pro-java-script-support/ for a list)
import { DSPStream } from "dspstream.js";
// function receives the result of the "Average" processing block and simply forwards it to the script block output
function onPacket(flags, meta, samples) {
let packet = meta;
packet.samples = samples();
DSPStream.sendPacket(0, packet);
}async function init() {
DSPStream.addBlocks({avg: { type: "Average" }}).then(() => {
return DSPStream.connectBlocks([{ source: "in0", drain: "avg" }, { source: "avg", drain: "script", input: "in0" }]);
}).then(() => {
DSPStream.receivePackets(0, onPacket);
});
}function main() {
}init().then(() => {
main();
});
Thank you for your reply
in the spectrum , Average trace has some good setting
When we use this trace with DSP processing Block, then is it possible to do this setting ?
could you please add this setting in your example code ?
Thanks
Quote from mm_dev on 16/05/2022, 14:56Changed the code sample to include "Average Samples" and "Average Power" config options. The other options are not available in the script block at this time.
Changed the code sample to include "Average Samples" and "Average Power" config options. The other options are not available in the script block at this time.