Eclipse set breakpoint for fortran project - eclipse

I have a simple fortran project on Eclipse with two source files program.f90 and KASTBitmap.f90 which contains some functions I am currently writing as a library for bitmap images includes loading/saving/manipulating images.
I am trying to set a break point in KASTBitmap.f90 and when I start the debugger I get this error:
At line 18 of file ../KASTBitmap.f90 (unit = 1, file = 'FaceImg5.bmp')
Fortran runtime error: Non-existing record number
any ideas or hints are appreciated.

Related

unable to interface my c++ application with MATLAB

I have written a program in c++11. My intention is to use MATLAB environment for plotting.
So, I followed these two links to have some idea:MATLAB_Build C++ Engine programs and c++ start MATLAB session. (There must be other ways to interface MATLAB and c++. But I want to know where is my fault before trying other ones)
As those above links have suggested I built my project accordingly using visual studio '17. The initial errors that I found was, my application could not locate the following .dll files libMatlabEngine.dll, libMatlabdataArray.lib.
So, I moved my .dlls to the executable location as suggested here. But after then my code is throwing the following error: 0xC0000005: Access violation executing location 0x0000000000000000.
Below is the piece of code that I'm trying. I guess it's the startMATLAB() which is returning a NULL pointer and the code is failing for that. But I can't figure out what's the reason.
Appreciate your help.
//Start the MATLAB engine
using namespace matlab::engine;
using namespace matlab::data;
unique_ptr<MATLABEngine> matlabptr = startMATLAB();
//Cretae a matlab array factory
ArrayFactory factory;
auto inputArray = factory.createArray({ 1, 6 }, cppData.cbegin(), cppData.cend());
auto time_array = factory.createArray({ 1, 6 }, time.cbegin(), time.cend());
matlabptr->setVariable(convertUTF8StringToUTF16String("data"), move(inputArray));
matlabptr->setVariable(convertUTF8StringToUTF16String("time"), move(time_array));
matlabptr->eval(convertUTF8StringToUTF16String("plot(time, data)"));

How to use custom language highlight syntax in Gtk SourceView?

I'm trying to create my own language definition, and use it for highlighting the syntax in my app.
The issue I have is that, when trying to access the language definition from my app's data folder (/usr/share/myapp/), even using the c.lang file copied from /usr/share/gtksourceview-3.0/language-specs/, just to test, I get this error at runtime:
GtkSourceView-WARNING **: Failed to load '/usr/share/myapp/c.lang': could not find the RelaxNG schema file
So it's asking for some schema file? So I went forward and copied every file from the language-specs folder that isn't a lang file, which includes: language.dtd, language.rng and language2.rng.
Now, when I run again, I get these errors:
GtkSourceView-WARNING **: in file /usr/share/com.github.aleksandar-stefanovic.urmsimulator/c.lang: style 'def:comment' not defined
GtkSourceView-WARNING **: Failed to load '/usr/share/com.github.aleksandar-stefanovic.urmsimulator/c.lang': unable to resolve language 'def'
What does that even mean? Is that something namespace-related? It is very peculiar, because the exact same file is working perfectly when in gtksourceview folder.
Any clues? Do these "RelaxNG" files work only in their original directories? If so, how can I change that? I've looked into the files, but failed to find any reference to their original folder...
This is the source-code (in Vala) related to the issue:
var manager = Gtk.SourceLanguageManager.get_default ();
string search_paths[] = {"/usr/share/myapp", null};
manager.set_search_path (search_paths);
var buffer = new Gtk.SourceBuffer.with_language (manager.get_language ("c"));
The application does in fact find the language "c", I've checked by debugging.
You have to preserve the Gtk.SourceLanguageManager's original search path when you add your own. Append to it instead of replacing it.

Referencing External Files in JModelica

I have a Modelica file that references c code during simulation through an external library *.a file.
For example:
model CallAdd
input Real FirstInput(start=0);
input Real SecondInput(start=0);
output Real FMUOutput(start=0);
function CAdd
input Real x(start=0);
input Real y(start=0);
output Real z(start=0);
external "C" annotation(Library = "CAdd", LibraryDirectory = "modelica://CallAdd");
end CAdd;
equation
FMUOutput = CAdd(FirstInput,SecondInput);
annotation(uses(Modelica(version = "3.2.1")));
end CallAdd;
When opening the Modelica model in OpenModelica the required files appear to be automatically loaded because it simulates and gives appropriate results.
However, when I try to compile the Modelica file with JModelica-SDK-1.12 I receive an error that the library *.a file could not be found.
So my question is: What is the proper way to reference additional files when using compile_fmu in JModelica?
With no success, I've tried:
# Import the compiler function
from pymodelica import compile_fmu
model_name = "CallAdd"
mo_file = "CallAdd.mo"
# Compile the model and save the return argument, for use later if wanted
my_fmu = compile_fmu(model_name, mo_file, target="cs",compiler_options = {'extra_lib_dirs':'C:/ToFolderContainingLib/'})
The strange thing is that when I was using JModelica-1.17 (non-SDK) the file compiled fine but the results didn't make sense. I was recommended to try the SDK version to see if it fixed my errors in my previous post here.
Try positioning the external library in sub-folder named as the platform your currently on. So in your example, I'd position the library (libCAdd.a) in sub-folder named linux64, as I'm on a 64bit Linux machine and then run the code.
If is a small piece of C code, as a last alternative you could try to include the C file directly in the Modelica code:
external "C" annotation(Include="
// the entire C code here
");
Hopefully the JModelica people will give you a better answer soon.
You could try to ask this on their website also:
http://www.jmodelica.org/forum

Error using matlab.io.fits.openFile - cannot open FITS files

I am running a code that uses the fitsread function to open my fits movies and analyse them. It was working perfectly fine until about a week ago, when, without me doing anything, it started giving the following error whenever I try to run it:
Error using matlab.io.fits.openFile (line 48)
Unable to open file. File might be corrupt or filename might have unsupported
characters.
Error in fitsread>read_image_hdu (line 412)
fptr = fits.openFile(info.Filename);
Error in fitsread (line 125)
data = read_image_hdu(info,1,raw,pixelRegion);
I have tried manually checking the properties of such files using the fitsinfo function and nothing was wrong with the files themselves. I have also tried to re-set the default MATLAB path, delete them from the working folder and re-download them from a central University server where they were originally stored upon acquisition on a microscope, but it didn't help either. A collaborator has tried running the same code on his machine and it works well. I get this same error on both MATLAB versions R2011b and R2015b. It originally used to work on R2011b with the same files.
Thanks in advance to whoever will be able to help!

Fiji error: "No images file selected" when using a macro that calls the plugin 'Average Images'

I would like to create a macro with Fiji, that then I would run by using matlab.
I would like to average 3 images by using the Plugins>Stacks>Average Images.
I used first Plugins>Macro>Record... to get an idea what to use. Here is the result:
run("Average Images", "add=D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\Measurement._cb_frame0_pvar-8bit_combined.tif add=D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\Measurement._cb_frame1_pvar-8bit_combined.tif add=D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\Measurement._cb_frame2_pvar-8bit_combined.tif");
saveAs("Tiff", "D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\test.tif");
However, even when I run this macro I got an error: No images file selected. However, in Fiji you do not need to open any images to run the plugin but you add the files through a window interface...
So of course, since just running the macro is not working I get the same error when I use the following macro:
file = getArgument;
if (file=="") exit ("No argument!");
setBatchMode(true);
file_vasc = file;
file_vasc_frame_0 = file;
file_vasc_frame_1 = replace(file, "\\_frame0_pvar-8bit_combined.tif", "_frame1_pvar-8bit_combined.tif");
file_vasc_frame_2 = replace(file, "\\_frame0_pvar-8bit_combined.tif", "_frame2_pvar-8bit_combined.tif");
run("Average Images", "add=file_vasc_frame_0 add=file_vasc_frame_1 add=file_vasc_frame_2");
file_vasc_out = replace(file, "frame0_pvar-8bit_combined.tif", "_vasc_averaged.tif");
saveAs("Tiff", file_vasc_out);
Somebody has an idea what should I do?
Thanks
The Average Images plugin is using dialogs in a non-standard way and therefore is not scriptable: when running the plugin in Fiji with the macro recorder active (Plugins>Macros>Record... and then Plugins>Stacks>Average Images), you will see Fiji complain as soon as you add a second file to the list:
Duplicate keyword:
Command: "Average images"
Keyword: "add"
Value: /path/to/your/file
Add an underscore to the corresponding label in the dialog to make the first word unique.
This clearly is a bug in the plugin (it makes multiple use of the same OpenDialog thereby recording duplicate keywords in the macro recorder). You can report it via Help>Report a bug, however I fear that this plugin is not actively maintained at the moment.
In any case, there is a simple alternate way to average images in ImageJ without requiring this plugin, using the Image>Stacks>Images to Stack and Image>Stacks>Z Project... commands:
setBatchMode(true);
open("/path/to/first-image.tif");
open("/path/to/second-image.tif");
run("Images to Stack", "name=stack title=[]");
run("Z Project...");
saveAs("Tiff", "/path/to/new-file-name.tif");