TensorflowJS and Pixinsight (import issue)

MisterZed

New member
Hi all !

I'm currently trying to write a script in pixinsight that use tensorflowJS.
I've made de simple model with only one neurone in it, trained with an X array and Y array. All is written in python with google colab. This neural network only does a linear regression (it's only for the test, later I will try to do denoising). Then in colab I've converted my neural network into JSON file that can be loaded with tensorflowJS.
My problem is : I need to load the library tfjs.min.js in my script to use the JSON file but I cannot do it with the methods below.

tf.min.js is a file in the same folder than my script.

Here what I've tried :
1610982705908.png

and :
1610982724547.png


None of these 2 examples works...

Can someone help me to do it ?

best regards,
Baptiste ZLOCH
 
Last edited:
Hi Baptiste,

The #include preprocessor directive of our JavaScript runtime (which obviously is a nonstandard, custom feature of our implementation) works exactly like the equivalent preprocessor directive in the C and C++ languages. So we have two use cases:

#include <foo.bar>

In this case the preprocessor will look for a "foo.bar" file in the standard include search directories of the running script. By default, this is always:

<pixinsight-install-dir>/include/pjsr

where <pixinsight-install-dir> represents the directory where the running PixInsight application has been installed. You can add more standard include search directories as follows:

- Open the Script Editor window.
- On Script Editor, select EXECUTE > Include Directories
- Here you have two options: This file and Global. Select the option that best suits your needs.

#include "foo.bar"

This directive will look for "foo.bar" exclusively in the same directory of the JavaScript source code file where the directive is found.

Of course, in both cases you can specify relative subdirectories. For example:

#include <path/to/foo.bar>

will search for:

<pixinsight-install-dir>/include/pjsr/path/to/foo.bar

Let me know if this helps.
 
Hi Baptiste,

The #include preprocessor directive of our JavaScript runtime (which obviously is a nonstandard, custom feature of our implementation) works exactly like the equivalent preprocessor directive in the C and C++ languages. So we have two use cases:

#include <foo.bar>

In this case the preprocessor will look for a "foo.bar" file in the standard include search directories of the running script. By default, this is always:

<pixinsight-install-dir>/include/pjsr

where <pixinsight-install-dir> represents the directory where the running PixInsight application has been installed. You can add more standard include search directories as follows:

- Open the Script Editor window.
- On Script Editor, select EXECUTE > Include Directories
- Here you have two options: This file and Global. Select the option that best suits your needs.

#include "foo.bar"

This directive will look for "foo.bar" exclusively in the same directory of the JavaScript source code file where the directive is found.

Of course, in both cases you can specify relative subdirectories. For example:

#include <path/to/foo.bar>

will search for:

<pixinsight-install-dir>/include/pjsr/path/to/foo.bar

Let me know if this helps.

Hi Juan !

Thank you very much I can import my library correctly ! I still have a problem but I think it's in the .js it self. That still happens if i replace all the \n in my file...

1611575518368.png


Best regards,
Baptiste ZLOCH
 
Back
Top