Why won't Scilab open an image file? - image

I am trying to work with image files under Scilab, and I get stuck at the very beginning, unable to load an image file.
I have searched the help system as well as the Web, tried two versions of Scilab (because some of the answers I found say that 6.0 is incompatible with some image functions) and still drew a blank. Whatever I try, the imread function is simply not there.
Here is what I get:
Under Scilab 6.0.2:
--> clear
--> atomsSystemUpdate()
Scanning repository http://atoms.scilab.org/6.0 ... Done
--> atomsInstall("SIVP")
atomsInstallList: The package "SIVP" is not registered.
Please check on the ATOMS repository that it is available for Scilab 6.0 on Windows.
If it is, run atomsSystemUpdate() before trying atomsInstall(..) again.
at line 52 of function atomsError ( C:\Program Files\scilab-6.0.2\modules\atoms\macros\atoms_internals\atomsError.sci line 66 )
at line 78 of function atomsInstallList ( C:\Program Files\scilab-6.0.2\modules\atoms\macros\atoms_internals\atomsInstallList.sci line 117 )
at line 233 of function atomsInstall ( C:\Program Files\scilab-6.0.2\modules\atoms\macros\atomsInstall.sci line 249 )
--> atomsInstall("IPCV")
ans =
[]
--> disp( atomsGetInstalled() );
!IPCV 4.1.2 user SCIHOME\atoms\x64\IPCV\4.1.2 I !
--> im=imread("Kratka220.tif")
Undefined variable: imread
Under Scilab 5.5.2:
-->clear
-->atomsSystemUpdate()
Scanning repository http://atoms.scilab.org/5.5 ... Done
-->atomsInstall("SIVP")
ans =
[]
-->atomsInstall("IPCV")
atomsInstallList: Pakiet IPCV nie jest dostępny.
<this is Polish for "Package IPCV is not available"; I installed 5.5.2 in Polish>
!--error 10000
at line 51 of function atomsError called by :
at line 76 of function atomsInstallList called by :
at line 233 of function atomsInstall called by :
atomsInstall("IPCV")
-->disp( atomsGetInstalled() );
column 1 to 4
!SIVP 0.5.3.2 user SCIHOME\atoms\x64\SIVP\0.5.3.2 !
column 5
!I !
-->im=imread("Kratka220.tif")
!--error 4
Niezdefiniowana zmienna: imread
<this is Polish for "undefined variable">
What am I doing wrong?

After atomsInstall you have to restart Scilab to load the toolbox.

Related

MuscleCommandLine non-zero return code 1/is not recognized as an internal or external command,

I am trying to align 4 difference sequences using MuscleCommandLine. This code works perfectly on Anaconda and Mac but I am trying to make it work on Windows and I am having several issues.
muscle_exe = r'../muscle3.8.31_i86darwin64.exe'
in_file = r'../infile.fasta'
out_file = r'../aln_out.fasta'
muscle_cline = MuscleCommandline(muscle_exe, input=in_file, out=out_file)
muscle_cline()
When I try this using Anaconda on Mac, I get the result. However, when running the same code on Window, I get the following error:
---------------------------------------------------------------------------
ApplicationError Traceback (most recent call last)
<ipython-input-3-70ad09443dc6> in <module>
3 genome = genome_location(before, after, alignment)
4
----> 5 filename = custom_fasta(genome, alignment)
6
7 info = AlignIO.read(r'../aln_out.fasta','fasta')
<ipython-input-1-655071c8d454> in custom_fasta(locations_dict, names)
185
186 muscle_cline = MuscleCommandline(muscle_exe, input=in_file, out=out_file)
--> 187 muscle_cline()
188
189 return(filename)
~\Anaconda3\lib\site-packages\Bio\Application\__init__.py in __call__(self, stdin, stdout, stderr, cwd, env)
567
568 if return_code:
--> 569 raise ApplicationError(return_code, str(self), stdout_str, stderr_str)
570 return stdout_str, stderr_str
571
ApplicationError: Non-zero return code 1 from '../muscle3.8.31_i86darwin64.exe -in ../infile.fasta -out ../aln_out.fasta', message "'..' is not recognized as an internal or external command,"
I have read the documentation but this is not listed as an issue. This same question has been asked before but no solution has been offered. People keep asking to install muscle, but the way it works with Biopython and Anaconda is that you do not need to install it.
So why does this keep happening?

Why does Explainable AI not find implementations of the model?

In this Notebook, we use Explainable AI SDK from Google to load a model, right after saving it. This fails with a message that the model is missing.
But note
the info message saying that the model was saved
checking working/model shows that the model is there.
However, working/model/assets is empty.
Why do we get this error message? How can we avoid it?
model_path = "working/model"
model.save(model_path)
builder = SavedModelMetadataBuilder(model_path)
builder.set_numeric_metadata(
"numpy_inputs",
input_baselines=[X_train.median().tolist()], # attributions relative to the median of the target
index_feature_mapping=X_train.columns.tolist(), # the names of each feature
)
builder.save_metadata(model_path)
explainer = explainable_ai_sdk.load_model_from_local_path(
model_path=model_path,
config=configs.SampledShapleyConfig(path_count=20),
)
INFO:tensorflow:Assets written to: working/model/assets
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/tmp/ipykernel_26061/1928503840.py in <module>
18 explainer = explainable_ai_sdk.load_model_from_local_path(
19 model_path=model_path,
---> 20 config=configs.SampledShapleyConfig(path_count=20),
21 )
22
/opt/conda/lib/python3.7/site-packages/explainable_ai_sdk/model/model_factory.py in load_model_from_local_path(model_path, config)
128 """
129 if _LOCAL_MODEL_KEY not in _MODEL_REGISTRY:
--> 130 raise NotImplementedError('There are no implementations of local model.')
131 return _MODEL_REGISTRY[_LOCAL_MODEL_KEY](model_path, config)
132
NotImplementedError: There are no implementations of local model.

Using handles to nested function for GUI callbacks in Octave

I am trying to develop a GUI in Octave (4.0.1, using the GUI version) with the code as follows:
Main GUI function
Function to create figure & various uicontrol
Callback function for uicontrol #1
Callback function for uicontrol #2
Callback function for uicontrol #3
etc...
Each function is delimited by function & end. The first callback I tried to write looks like this: the button is defined in the "graphical creation" function as:
gui.select_btn = uicontrol('Style','pushbutton','String','Select log file ...',...
'Units','normalized','Position',[0.01 0.52 0.25 0.47],...
'BackgroundColor',get(gui.Window,'Color'),'Parent',gui.file_panel,...
'Enable','on','Callback',{#browse_log_file,gui});
and the callback for it is defined in the callback function later as:
function browse_log_file(src,data,gui)
% Called when user presses the "Select log file ..." button
[fname, pname] = uigetfile({'*.log'},'Select log file');
set(gui.log_file_edit,'String',[pname,fname]);
end
whi gui being a struct defined in the main GUI function by calling the "graphical creation" function & accessible by all nested functions.
However, when I try to run the code, I get the following error message:
error: handles to nested functions are not yet supported
error: called from
GUI_analyser>create_interface at line 71 column 20
GUI_analyser at line 8 column 7
error: evaluating argument list element number 1
error: called from
GUI_analyser>create_interface at line 71 column 20
GUI_analyser at line 8 column 7
error: evaluating argument list element number 16
error: called from
GUI_analyser>create_interface at line 71 column 20
GUI_analyser at line 8 column 7
pointing to the line with {#browse_log_file,gui}.
Any suggestions on how to work round this problem?

How to find the line causing error in Julia?

Suppose there is a script A that calls function B, both in Julia.
There are some errors in function B, which cause the script to be stopped at runtime.
Is there a neat way to find out which line is causing the error?
It does not make any sense, to have to put messages like println manually in each line to find out upto which line the code survives, and in which line error happens.
Edit: I am using Linux Red Hat 4.1.2 and Julia version 0.3.6. directly. With no IDE.
Reading the backtrace:
juser#juliabox:~$ cat foo.jl
# line 1 empty comment
foo() = error("This is line 2")
foo() # line 3
juser#juliabox:~$ julia foo.jl
ERROR: This is line 2
in foo at /home/juser/foo.jl:2
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
while loading /home/juser/foo.jl, in expression starting on line 3
This lines in foo at /home/juser/foo.jl:2 ... while loading /home/juser/foo.jl, in expression starting on line 3 reads as: "there was an error at line 2 in /home/juser/foo.jl file ... while loading /home/juser/foo.jl, in expression starting on line 3"
Looks pretty clear to me!
Edit: /home/juser/foo.jl:2 means; file: /home/juser/foo.jl, line number: 2.
Also you could use #show macro instead of println function for debugging purposes:
julia> println(1 < 5 < 10)
true
julia> #show 1 < 5 < 10
(1<5<10) => true
true

Config File Loads Twice

I'm using codeigniter. Suddenly, for some reason, my application/config/config.php started loading twice.
I have the following code at the top of config file, starts from line 5 to line 12:
function __autoload ($class) {
$file = APPPATH . 'libraries/' . $class . EXT;
if (strpos($class, 'CI_') !== 0) {
if (file_exists($file) && is_file($file)) {
#include_once (APPPATH . 'libraries/' . $class . EXT);
}
}
}
When i test a page, i get this error:
Fatal error: Cannot redeclare __autoload() (previously declared in C:\xampp\htdocs\ci_centric\application\config\config.php:5) in C:\xampp\htdocs\ci_centric\application\config\config.php on line 12
If i wrap the autoload with if(!function_exists('__autoload')) { ... }, i get the following output:
Notice: Constant FRONTEND_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 390
Notice: Constant FRONTEND_WEBPARTS_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 391
Notice: Constant FRONTEND_MAINPAGES_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 392
Notice: Constant BACKEND_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 393
Notice: Constant BACKEND_WEBPARTS_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 394
Notice: Constant BACKEND_MAINPAGES_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 395
Notice: Constant BACKEND_MAINPAGES_PATH already defined in C:\xampp\htdocs\ci_centric\application\config\config.php on line 396
.
.
.
Everything used to work fine for days; i played little bit with $this->session->flashdata('...'); then i got the config double loading problem.
Any help will be appreciated...
Well, I don't know what kind of hacks do you use, and WHY do you do such things in a configuration file, where only variables should be declared. You should remove that code or better even start from a fresh copy of CodeIgniter. You don't know where and for what purpose CodeIgniter wants to load this file twice. Anyway, you should not do such things by any means. If it's really necessary for some awkward reason, you can try moving this to MY_core.php or even index.php file, it's still will be totally wrong, but much better than what you have right now.

Resources