Guest User

Untitled

a guest
Nov 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include "fitsio.h"
  4.  
  5. int main() {
  6. fitsfile *fptr;
  7. int status = 0, i;
  8.  
  9. fits_open_file(&fptr, "WFPC2ASSNu5780205bx.fits", READONLY, &status);
  10. long naxes[2];
  11. fits_get_img_size(fptr, 3, naxes, &status);
  12.  
  13. fitsfile *ofptr;
  14. fits_create_file(&ofptr, "o_nasa.fits", &status);
  15. fits_copy_header(fptr, ofptr, &status);
  16.  
  17. long fp[2] = {1, 1};
  18. long nelements = naxes[0];
  19.  
  20. float arr[nelements];
  21. for (i = 0; i < nelements; i++) {
  22. arr[i] = 100;
  23. }
  24.  
  25. int ii, jj, kk;
  26. for (ii = 1; ii <= naxes[0]; ii++) {
  27. for (jj = 1; jj <= naxes[1]; jj++) {
  28. fits_write_pix(ofptr, TFLOAT, fp, nelements, arr, &status); // this is not working
  29. }
  30. }
  31. fits_close_file(ofptr, &status);
  32. fits_close_file(fptr, &status);
  33.  
  34. return status;
  35. }
Add Comment
Please, Sign In to add comment