File: psf-base.c

package info (click to toggle)
fitsh 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,768 kB
  • ctags: 4,050
  • sloc: ansic: 53,352; makefile: 1,120; sh: 25
file content (45 lines) | stat: -rw-r--r-- 1,397 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*****************************************************************************/
/* psf-base.c								     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Functions related to basic/common PSF handling. Actually, there is only   */
/* one function here: psf_symmetrize()...		 	             */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* (c) 2006; Pal, A. (apal@szofi.elte.hu)			             */
/*****************************************************************************/

#include "psf.h"
#include "psf-base.h"

/*****************************************************************************/

int psf_symmetrize(psf *pdata)
{
 double	**parr,p,***psfstack;
 int	i,j,w,nrd,nval;

 w=pdata->grid*(pdata->hsize*2+1);
 nval=(pdata->order+1)*(pdata->order+2)/2;

 psfstack=pdata->coeff;

 for ( nrd=nval ; nrd>0 ; nrd--,psfstack++ )
  {	parr=*psfstack;
	for ( i=0 ; i<(w+1)/2 ; i++ )
	 {	for ( j=i ; j<(w+1)/2 ; j++ )
		 {	p=parr[i][j]+parr[j][i]+
			  parr[w-1-i][j]+parr[w-1-j][i]+
			  parr[i][w-1-j]+parr[j][w-1-i]+
			  parr[w-1-i][w-1-j]+parr[w-1-j][w-1-i];
			p=p/8.0;
			parr[i][j]=parr[j][i]=
			parr[w-1-i][j]=parr[w-1-j][i]=
			parr[i][w-1-j]=parr[j][w-1-i]=
			parr[w-1-i][w-1-j]=parr[w-1-j][w-1-i]=p;
		 }
	 }
  }
 return(0);	
}

/*****************************************************************************/