read_fits_image.oct save_fits_image.oct save_fits_image_multi_ext.octWhere to put them, I had no idea, but
locate \ .octbrought me to the directory
/usr/lib/octave/3.4.2/oct/i586-mandriva-linux-gnu/where (on behalf of the root, of course) the files were copied. Having started Octave, I first checked whether these commands work. Work. To read the file filename.fits in the var variable you need to do:
var = read_fits_image("filename.fits");
The main thing is not to forget the semicolon at the end of the command, in order not to get streams of numbers! I remembered the semicolon when I forgot to put it. I was pleasantly surprised that, unlike the matlab, flooding the user with an endless stream of data, Octave splits the output by pages (to all appearances, less is used to display on the screen). To read the file header, let's execute: [var, head] = read_fits_image("filename.fits");
The whos command shows that head is a string array with a length of 80 characters (recall the FITS format restrictions), into which the entire file header is simply rewritten line by line without splitting into name / value / comment (that is, if you plan to work with Octave in , I’ll have to do all this myself, or I can add the necessary functions to the FITS package, there is a good tool for this). I tried to display the file on the screen using imshow. Oh no! I saw ... absolutely nothing. But imagesc showed me a picture and even changed the color map for colormap commands. If you want to display a picture on a logarithmic scale: imagesc(log(var));
The display will be more pleasant. Remembering my fitsview , I regretted that using gnuplot as an “scribe” is very irritating: you have to wait for quite a while for Octave to transfer the necessary data to the screen, and then to display it on the screen. and finally, a simple little program for adding files in a directory that looks like object_XXXX.fit (where XXXX is a number), starting with the first number and ending with the last number: function ret = sum_fits(first, last) ret = [1 2 3]; frst = 1; i = 0; for num = [ first : last ] i++; name = sprintf("object_%04d.fit", num); % II = read_fits_image(name); % med = median(median(II)); % printf("%d:\tread file %s, median = %d\n", i, name, med); fflush(1); % ! II -= med; % "" (bias' ) if(frst == 1) % frst = 0; ret = II; else ret += II; end end end
And an example for images obtained to determine the coordinates of the center of rotation of the field: II = sum_fits(1,147); a = II; a(find(a < 1)) = 1; imagesc(log(a))
We get this picture:Source: https://habr.com/ru/post/132784/
All Articles