Commit 2c2dac03 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

remove files

parent 4afd1181
#include <math.h>
float gasdev(long *idum)
{
float ran1(long *idum);
static int iset=0;
static float gset;
float fac,rsq,v1,v2;
if (iset == 0) {
do {
v1=2.0*ran1(idum)-1.0;
v2=2.0*ran1(idum)-1.0;
rsq=v1*v1+v2*v2;
} while (rsq >= 1.0 || rsq == 0.0);
fac=sqrt(-2.0*log(rsq)/rsq);
gset=v1*fac;
iset=1;
return v2*fac;
} else {
iset=0;
return gset;
}
}
/* (C) Copr. 1986-92 Numerical Recipes Software )1!. */
#if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#define NR_END 1
#define FREE_ARG char*
void nrerror(char error_text[])
/* Numerical Recipes standard error handler */
{
fprintf(stderr,"Numerical Recipes run-time error...\n");
fprintf(stderr,"%s\n",error_text);
fprintf(stderr,"...now exiting to system...\n");
exit(1);
}
float *vector(long nl, long nh)
/* allocate a float vector with subscript range v[nl..nh] */
{
float *v;
v=(float *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(float)));
if (!v) nrerror("allocation failure in vector()");
return v-nl+NR_END;
}
int *ivector(long nl, long nh)
/* allocate an int vector with subscript range v[nl..nh] */
{
int *v;
v=(int *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(int)));
if (!v) nrerror("allocation failure in ivector()");
return v-nl+NR_END;
}
unsigned char *cvector(long nl, long nh)
/* allocate an unsigned char vector with subscript range v[nl..nh] */
{
unsigned char *v;
v=(unsigned char *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(unsigned char)));
if (!v) nrerror("allocation failure in cvector()");
return v-nl+NR_END;
}
long *lvector(long nl, long nh)
/* allocate an long vector with subscript range v[nl..nh] */
{
long *v;
v=(long *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(long)));
if (!v) nrerror("allocation failure in lvector()");
return v-nl+NR_END;
}
double *dvector(long nl, long nh)
/* allocate a double vector with subscript range v[nl..nh] */
{
double *v;
v=(double *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(double)));
if (!v) nrerror("allocation failure in dvector()");
return v-nl+NR_END;
}
float **matrix(long nrl, long nrh, long ncl, long nch)
/* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
float **m;
/* allocate pointers to rows */
m=(float **) malloc((size_t)((nrow+NR_END)*sizeof(float*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(float *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
double **dmatrix(long nrl, long nrh, long ncl, long nch)
/* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
double **m;
/* allocate pointers to rows */
m=(double **) malloc((size_t)((nrow+NR_END)*sizeof(double*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(double *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
int **imatrix(long nrl, long nrh, long ncl, long nch)
/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
int **m;
/* allocate pointers to rows */
m=(int **) malloc((size_t)((nrow+NR_END)*sizeof(int*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(int *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(int)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch,
long newrl, long newcl)
/* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
{
long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl;
float **m;
/* allocate array of pointers to rows */
m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
if (!m) nrerror("allocation failure in submatrix()");
m += NR_END;
m -= newrl;
/* set pointers to rows */
for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch)
/* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
and ncol=nch-ncl+1. The routine should be called with the address
&a[0][0] as the first argument. */
{
long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1;
float **m;
/* allocate pointers to rows */
m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
if (!m) nrerror("allocation failure in convert_matrix()");
m += NR_END;
m -= nrl;
/* set pointers to rows */
m[nrl]=a-ncl;
for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
/* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
{
long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
float ***t;
/* allocate pointers to pointers to rows */
t=(float ***) malloc((size_t)((nrow+NR_END)*sizeof(float**)));
if (!t) nrerror("allocation failure 1 in f3tensor()");
t += NR_END;
t -= nrl;
/* allocate pointers to rows and set pointers to them */
t[nrl]=(float **) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float*)));
if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
t[nrl] += NR_END;
t[nrl] -= ncl;
/* allocate rows and set pointers to them */
t[nrl][ncl]=(float *) malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(float)));
if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
t[nrl][ncl] += NR_END;
t[nrl][ncl] -= ndl;
for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
for(i=nrl+1;i<=nrh;i++) {
t[i]=t[i-1]+ncol;
t[i][ncl]=t[i-1][ncl]+ncol*ndep;
for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
}
/* return pointer to array of pointers to rows */
return t;
}
double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
/* allocate a double 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
{
long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
double ***t;
/* allocate pointers to pointers to rows */
t=(double ***) malloc((size_t)((nrow+NR_END)*sizeof(double**)));
if (!t) nrerror("allocation failure 1 in f3tensor()");
t += NR_END;
t -= nrl;
/* allocate pointers to rows and set pointers to them */
t[nrl]=(double **) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double*)));
if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
t[nrl] += NR_END;
t[nrl] -= ncl;
/* allocate rows and set pointers to them */
t[nrl][ncl]=(double *) malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(double)));
if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
t[nrl][ncl] += NR_END;
t[nrl][ncl] -= ndl;
for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
for(i=nrl+1;i<=nrh;i++) {
t[i]=t[i-1]+ncol;
t[i][ncl]=t[i-1][ncl]+ncol*ndep;
for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
}
/* return pointer to array of pointers to rows */
return t;
}
char **cmatrix(long nrl, long nrh, long ncl, long nch)
/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
char **m;
/* allocate pointers to rows */
m=(char **) malloc((size_t)((nrow+NR_END)*sizeof(char*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(char *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(char)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
void free_vector(float *v, long nl, long nh)
/* free a float vector allocated with vector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_ivector(int *v, long nl, long nh)
/* free an int vector allocated with ivector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_cvector(unsigned char *v, long nl, long nh)
/* free an unsigned char vector allocated with cvector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_lvector(long *v, long nl, long nh)
/* free an long vector allocated with lvector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_dvector(double *v, long nl, long nh)
/* free a double vector allocated with dvector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_matrix(float **m, long nrl, long nrh, long ncl, long nch)
/* free a float matrix allocated by matrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch)
/* free a double matrix allocated by dmatrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch)
/* free an int matrix allocated by imatrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch)
/* free a submatrix allocated by submatrix() */
{
free((FREE_ARG) (b+nrl-NR_END));
}
void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch)
/* free a matrix allocated by convert_matrix() */
{
free((FREE_ARG) (b+nrl-NR_END));
}
void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh)
/* free a float f3tensor allocated by f3tensor() */
{
free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
free((FREE_ARG) (t[nrl]+ncl-NR_END));
free((FREE_ARG) (t+nrl-NR_END));
}
void free_d3tensor(double ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh)
/* free a double f3tensor allocated by f3tensor() */
{
free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
free((FREE_ARG) (t[nrl]+ncl-NR_END));
free((FREE_ARG) (t+nrl-NR_END));
}
void free_cmatrix(char **m, long nrl, long nrh, long ncl, long nch)
/* free a character matrix allocated by matrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
#else /* ANSI */
/* traditional - K&R */
#include <stdio.h>
#define NR_END 1
#define FREE_ARG char*
void nrerror(error_text)
char error_text[];
/* Numerical Recipes standard error handler */
{
void exit();
fprintf(stderr,"Numerical Recipes run-time error...\n");
fprintf(stderr,"%s\n",error_text);
fprintf(stderr,"...now exiting to system...\n");
exit(1);
}
float *vector(nl,nh)
long nh,nl;
/* allocate a float vector with subscript range v[nl..nh] */
{
float *v;
v=(float *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(float)));
if (!v) nrerror("allocation failure in vector()");
return v-nl+NR_END;
}
int *ivector(nl,nh)
long nh,nl;
/* allocate an int vector with subscript range v[nl..nh] */
{
int *v;
v=(int *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(int)));
if (!v) nrerror("allocation failure in ivector()");
return v-nl+NR_END;
}
unsigned char *cvector(nl,nh)
long nh,nl;
/* allocate an unsigned char vector with subscript range v[nl..nh] */
{
unsigned char *v;
v=(unsigned char *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(unsigned char)));
if (!v) nrerror("allocation failure in cvector()");
return v-nl+NR_END;
}
long *lvector(nl,nh)
long nh,nl;
/* allocate an unsigned long vector with subscript range v[nl..nh] */
{
long *v;
v=(long *)malloc((int) ((nh-nl+1+NR_END)*sizeof(long)));
if (!v) nrerror("allocation failure in lvector()");
return v-nl+NR_END;
}
double *dvector(nl,nh)
long nh,nl;
/* allocate a double vector with subscript range v[nl..nh] */
{
double *v;
v=(double *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(double)));
if (!v) nrerror("allocation failure in dvector()");
return v-nl+NR_END;
}
float **matrix(nrl,nrh,ncl,nch)
long nch,ncl,nrh,nrl;
/* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
float **m;
/* allocate pointers to rows */
m=(float **) malloc((unsigned int)((nrow+NR_END)*sizeof(float*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(float *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(float)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
double **dmatrix(nrl,nrh,ncl,nch)
long nch,ncl,nrh,nrl;
/* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
double **m;
/* allocate pointers to rows */
m=(double **) malloc((unsigned int)((nrow+NR_END)*sizeof(double*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(double *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(double)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
int **imatrix(nrl,nrh,ncl,nch)
long nch,ncl,nrh,nrl;
/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
int **m;
/* allocate pointers to rows */
m=(int **) malloc((unsigned int)((nrow+NR_END)*sizeof(int*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(int *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(int)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
float **submatrix(a,oldrl,oldrh,oldcl,oldch,newrl,newcl)
float **a;
long newcl,newrl,oldch,oldcl,oldrh,oldrl;
/* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
{
long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl;
float **m;
/* allocate array of pointers to rows */
m=(float **) malloc((unsigned int) ((nrow+NR_END)*sizeof(float*)));
if (!m) nrerror("allocation failure in submatrix()");
m += NR_END;
m -= newrl;
/* set pointers to rows */
for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
float **convert_matrix(a,nrl,nrh,ncl,nch)
float *a;
long nch,ncl,nrh,nrl;
/* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
and ncol=nch-ncl+1. The routine should be called with the address
&a[0][0] as the first argument. */
{
long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1;
float **m;
/* allocate pointers to rows */
m=(float **) malloc((unsigned int) ((nrow+NR_END)*sizeof(float*)));
if (!m) nrerror("allocation failure in convert_matrix()");
m += NR_END;
m -= nrl;
/* set pointers to rows */
m[nrl]=a-ncl;
for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
double ***d3tensor(nrl,nrh,ncl,nch,ndl,ndh)
long nch,ncl,ndh,ndl,nrh,nrl;
/* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
{
long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
double ***t;
/* allocate pointers to pointers to rows */
t=(double ***) malloc((unsigned int)((nrow+NR_END)*sizeof(double**)));
if (!t) nrerror("allocation failure 1 in f3tensor()");
t += NR_END;
t -= nrl;
/* allocate pointers to rows and set pointers to them */
t[nrl]=(double **) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(double*)));
if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
t[nrl] += NR_END;
t[nrl] -= ncl;
/* allocate rows and set pointers to them */
t[nrl][ncl]=(double *) malloc((unsigned int)((nrow*ncol*ndep+NR_END)*sizeof(double)));
if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
t[nrl][ncl] += NR_END;
t[nrl][ncl] -= ndl;
for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
for(i=nrl+1;i<=nrh;i++) {
t[i]=t[i-1]+ncol;
t[i][ncl]=t[i-1][ncl]+ncol*ndep;
for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
}
/* return pointer to array of pointers to rows */
return t;
}
float ***f3tensor(nrl,nrh,ncl,nch,ndl,ndh)
long nch,ncl,ndh,ndl,nrh,nrl;
/* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
{
long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
float ***t;
/* allocate pointers to pointers to rows */
t=(float ***) malloc((unsigned int)((nrow+NR_END)*sizeof(float**)));
if (!t) nrerror("allocation failure 1 in f3tensor()");
t += NR_END;
t -= nrl;
/* allocate pointers to rows and set pointers to them */
t[nrl]=(float **) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(float*)));
if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
t[nrl] += NR_END;
t[nrl] -= ncl;
/* allocate rows and set pointers to them */
t[nrl][ncl]=(float *) malloc((unsigned int)((nrow*ncol*ndep+NR_END)*sizeof(float)));
if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
t[nrl][ncl] += NR_END;
t[nrl][ncl] -= ndl;
for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
for(i=nrl+1;i<=nrh;i++) {
t[i]=t[i-1]+ncol;
t[i][ncl]=t[i-1][ncl]+ncol*ndep;
for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
}
/* return pointer to array of pointers to rows */
return t;
}
char **cmatrix(nrl,nrh,ncl,nch)
long nch,ncl,nrh,nrl;
/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
{
long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
char **m;
/* allocate pointers to rows */
m=(char **) malloc((unsigned int)((nrow+NR_END)*sizeof(char*)));
if (!m) nrerror("allocation failure 1 in matrix()");
m += NR_END;
m -= nrl;
/* allocate rows and set pointers to them */
m[nrl]=(char *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(char)));
if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
m[nrl] += NR_END;
m[nrl] -= ncl;
for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
/* return pointer to array of pointers to rows */
return m;
}
void free_vector(v,nl,nh)
float *v;
long nh,nl;
/* free a float vector allocated with vector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_ivector(v,nl,nh)
int *v;
long nh,nl;
/* free an int vector allocated with ivector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_cvector(v,nl,nh)
long nh,nl;
unsigned char *v;
/* free an unsigned char vector allocated with cvector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_lvector(v,nl,nh)
long nh,nl;
long *v;
/* free an long vector allocated with lvector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_dvector(v,nl,nh)
double *v;
long nh,nl;
/* free a double vector allocated with dvector() */
{
free((FREE_ARG) (v+nl-NR_END));
}
void free_matrix(m,nrl,nrh,ncl,nch)
float **m;
long nch,ncl,nrh,nrl;
/* free a float matrix allocated by matrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
void free_dmatrix(m,nrl,nrh,ncl,nch)
double **m;
long nch,ncl,nrh,nrl;
/* free a double matrix allocated by dmatrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
void free_imatrix(m,nrl,nrh,ncl,nch)
int **m;
long nch,ncl,nrh,nrl;
/* free an int matrix allocated by imatrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
void free_submatrix(b,nrl,nrh,ncl,nch)
float **b;
long nch,ncl,nrh,nrl;
/* free a submatrix allocated by submatrix() */
{
free((FREE_ARG) (b+nrl-NR_END));
}
void free_convert_matrix(b,nrl,nrh,ncl,nch)
float **b;
long nch,ncl,nrh,nrl;
/* free a matrix allocated by convert_matrix() */
{
free((FREE_ARG) (b+nrl-NR_END));
}
void free_f3tensor(t,nrl,nrh,ncl,nch,ndl,ndh)
float ***t;
long nch,ncl,ndh,ndl,nrh,nrl;
/* free a float f3tensor allocated by f3tensor() */
{
free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
free((FREE_ARG) (t[nrl]+ncl-NR_END));
free((FREE_ARG) (t+nrl-NR_END));
}
void free_d3tensor(t,nrl,nrh,ncl,nch,ndl,ndh)
double ***t;
long nch,ncl,ndh,ndl,nrh,nrl;
/* free a float f3tensor allocated by f3tensor() */
{
free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
free((FREE_ARG) (t[nrl]+ncl-NR_END));
free((FREE_ARG) (t+nrl-NR_END));
}
void free_cmatrix(m,nrl,nrh,ncl,nch)
char **m;
long nch,ncl,nrh,nrl;
/* free a double matrix allocated by dmatrix() */
{
free((FREE_ARG) (m[nrl]+ncl-NR_END));
free((FREE_ARG) (m+nrl-NR_END));
}
#endif /* ANSI */
/* CAUTION: This is the ANSI C (only) version of the Numerical Recipes
utility file nrutil.h. Do not confuse this file with the same-named
file nrutil.h that may be supplied in a 'misc' subdirectory.
*That* file is the one from the book, and contains both ANSI and
traditional K&R versions, along with #ifdef macros to select the
correct version. *This* file contains only ANSI C. */
#ifndef _NR_UTILS_H_
#define _NR_UTILS_H_
static float sqrarg;
#define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg)
static double dsqrarg;
#define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg)
static double dmaxarg1,dmaxarg2;
#define DMAX(a,b) (dmaxarg1=(a),dmaxarg2=(b),(dmaxarg1) > (dmaxarg2) ?\
(dmaxarg1) : (dmaxarg2))
static double dminarg1,dminarg2;
#define DMIN(a,b) (dminarg1=(a),dminarg2=(b),(dminarg1) < (dminarg2) ?\
(dminarg1) : (dminarg2))
static float maxarg1,maxarg2;
#define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1) > (maxarg2) ?\
(maxarg1) : (maxarg2))
static float minarg1,minarg2;
#define FMIN(a,b) (minarg1=(a),minarg2=(b),(minarg1) < (minarg2) ?\
(minarg1) : (minarg2))
static long lmaxarg1,lmaxarg2;
#define LMAX(a,b) (lmaxarg1=(a),lmaxarg2=(b),(lmaxarg1) > (lmaxarg2) ?\
(lmaxarg1) : (lmaxarg2))
static long lminarg1,lminarg2;
#define LMIN(a,b) (lminarg1=(a),lminarg2=(b),(lminarg1) < (lminarg2) ?\
(lminarg1) : (lminarg2))
static int imaxarg1,imaxarg2;
#define IMAX(a,b) (imaxarg1=(a),imaxarg2=(b),(imaxarg1) > (imaxarg2) ?\
(imaxarg1) : (imaxarg2))
static int iminarg1,iminarg2;
#define IMIN(a,b) (iminarg1=(a),iminarg2=(b),(iminarg1) < (iminarg2) ?\
(iminarg1) : (iminarg2))
#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
void nrerror(char error_text[]);
float *vector(long nl, long nh);
int *ivector(long nl, long nh);
unsigned char *cvector(long nl, long nh);
long *lvector(long nl, long nh);
double *dvector(long nl, long nh);
float **matrix(long nrl, long nrh, long ncl, long nch);
double **dmatrix(long nrl, long nrh, long ncl, long nch);
int **imatrix(long nrl, long nrh, long ncl, long nch);
float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch,
long newrl, long newcl);
float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch);
float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
void free_vector(float *v, long nl, long nh);
void free_ivector(int *v, long nl, long nh);
void free_cvector(unsigned char *v, long nl, long nh);
void free_lvector(long *v, long nl, long nh);
void free_dvector(double *v, long nl, long nh);
void free_matrix(float **m, long nrl, long nrh, long ncl, long nch);
void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch);
void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch);
void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch);
void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch);
void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh);
int ***i3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
void free_i3tensor(int ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh);
unsigned char ***b3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
void free_b3tensor(unsigned char ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh);
double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
void free_d3tensor(double ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh);
char **cmatrix(long nrl, long nrh, long ncl, long nch);
void free_cmatrix(char **m, long nrl, long nrh, long ncl, long nch);
#endif /* _NR_UTILS_H_ */
#include <math.h>
#define PI 3.141592654
float poidev(float xm, int *idum)
{
float gammln(float xx);
float ran1(int *idum);
static float sq,alxm,g,oldm=(-1.0);
float em,t,y;
if (xm < 12.0) {
if (xm != oldm) {
oldm=xm;
g=exp(-xm);
}
em = -1;
t=1.0;
do {
++em;
t *= ran1(idum);
} while (t > g);
} else {
if (xm != oldm) {
oldm=xm;
sq=sqrt(2.0*xm);
alxm=log(xm);
g=xm*alxm-gammln(xm+1.0);
}
do {
do {
y=tan(PI*ran1(idum));
em=sq*y+xm;
} while (em < 0.0);
em=floor(em);
t=0.9*(1.0+y*y)*exp(em*alxm-gammln(em+1.0)-g);
} while (ran1(idum) > t);
}
return em;
}
float poidev_copy(float xm, int *idum)
{
float gammln(float xx);
float ran1_copy(int *idum);
static float sq1,alxm1,g1,oldm1=(-1.0);
float em,t,y;
if (xm < 12.0) {
if (xm != oldm1) {
oldm1=xm;
g1=exp(-xm);
}
em = -1;
t=1.0;
do {
++em;
t *= ran1_copy(idum);
} while (t > g1);
} else {
if (xm != oldm1) {
oldm1=xm;
sq1=sqrt(2.0*xm);
alxm1=log(xm);
g1=xm*alxm1-gammln(xm+1.0);
}
do {
do {
y=tan(PI*ran1_copy(idum));
em=sq1*y+xm;
} while (em < 0.0);
em=floor(em);
t=0.9*(1.0+y*y)*exp(em*alxm1-gammln(em+1.0)-g1);
} while (ran1_copy(idum) > t);
}
return em;
}
#undef PI
/* (C) Copr. 1986-92 Numerical Recipes Software )1!. */
#define IA 16807
#define IM 2147483647
#define AM (1.0/IM)
#define IQ 127773
#define IR 2836
#define NTAB 32
#define NDIV (1+(IM-1)/NTAB)
#define EPS 1.2e-7
#define RNMX (1.0-EPS)
float ran1(int *idum)
{
int j;
int k;
//static
static int iy=0;
static int iv[NTAB];
float temp;
if (*idum <= 0 || !iy) {
if (-(*idum) < 1) *idum=1;
else *idum = -(*idum);
for (j=NTAB+7;j>=0;j--) {
k=(*idum)/IQ;
*idum=IA*(*idum-k*IQ)-IR*k;
if (*idum < 0) *idum += IM;
if (j < NTAB) iv[j] = *idum;
}
iy=iv[0];
}
k=(*idum)/IQ;
*idum=IA*(*idum-k*IQ)-IR*k;
if (*idum < 0) *idum += IM;
j=iy/NDIV;
iy=iv[j];
iv[j] = *idum;
if ((temp=AM*iy) > RNMX) return RNMX;
else return temp;
}
float ran1_copy(int *idum)
{
int j;
int k;
//static
static int iy1=0;
static int iv1[NTAB];
float temp;
if (*idum <= 0 || !iy1) {
if (-(*idum) < 1) *idum=1;
else *idum = -(*idum);
for (j=NTAB+7;j>=0;j--) {
k=(*idum)/IQ;
*idum=IA*(*idum-k*IQ)-IR*k;
if (*idum < 0) *idum += IM;
if (j < NTAB) iv1[j] = *idum;
}
iy1=iv1[0];
}
k=(*idum)/IQ;
*idum=IA*(*idum-k*IQ)-IR*k;
if (*idum < 0) *idum += IM;
j=iy1/NDIV;
iy1=iv1[j];
iv1[j] = *idum;
if ((temp=AM*iy1) > RNMX) return RNMX;
else return temp;
}
#undef IA
#undef IM
#undef AM
#undef IQ
#undef IR
#undef NTAB
#undef NDIV
#undef EPS
#undef RNMX
/* (C) Copr. 1986-92 Numerical Recipes Software )1!. */
#define IM1 2147483563
#define IM2 2147483399
#define AM (1.0/IM1)
#define IMM1 (IM1-1)
#define IA1 40014
#define IA2 40692
#define IQ1 53668
#define IQ2 52774
#define IR1 12211
#define IR2 3791
#define NTAB 32
#define NDIV (1+IMM1/NTAB)
#define EPS 1.2e-7
#define RNMX (1.0-EPS)
float ran2(long *idum)
{
int j;
long k;
static long idum2=123456789;
static long iy=0;
static long iv[NTAB];
float temp;
if (*idum <= 0) {
if (-(*idum) < 1) *idum=1;
else *idum = -(*idum);
idum2=(*idum);
for (j=NTAB+7;j>=0;j--) {
k=(*idum)/IQ1;
*idum=IA1*(*idum-k*IQ1)-k*IR1;
if (*idum < 0) *idum += IM1;
if (j < NTAB) iv[j] = *idum;
}
iy=iv[0];
}
k=(*idum)/IQ1;
*idum=IA1*(*idum-k*IQ1)-k*IR1;
if (*idum < 0) *idum += IM1;
k=idum2/IQ2;
idum2=IA2*(idum2-k*IQ2)-k*IR2;
if (idum2 < 0) idum2 += IM2;
j=iy/NDIV;
iy=iv[j]-idum2;
iv[j] = *idum;
if (iy < 1) iy += IMM1;
if ((temp=AM*iy) > RNMX) return RNMX;
else return temp;
}
#undef IM1
#undef IM2
#undef AM
#undef IMM1
#undef IA1
#undef IA2
#undef IQ1
#undef IQ2
#undef IR1
#undef IR2
#undef NTAB
#undef NDIV
#undef EPS
#undef RNMX
/* (C) Copr. 1986-92 Numerical Recipes Software )1!. */
#define NRANSI
#include "nrutil.h"
#define SWAP(a,b) temp=(a);(a)=(b);(b)=temp;
#define M 7
#define NSTACK 50
void sort(unsigned long n, float arr[])
{
unsigned long i,ir=n,j,k,l=1;
int jstack=0,*istack;
float a,temp;
istack=ivector(1,NSTACK);
for (;;) {
if (ir-l < M) {
for (j=l+1;j<=ir;j++) {
a=arr[j];
for (i=j-1;i>=1;i--) {
if (arr[i] <= a) break;
arr[i+1]=arr[i];
}
arr[i+1]=a;
}
if (jstack == 0) break;
ir=istack[jstack--];
l=istack[jstack--];
} else {
k=(l+ir) >> 1;
SWAP(arr[k],arr[l+1])
if (arr[l+1] > arr[ir]) {
SWAP(arr[l+1],arr[ir])
}
if (arr[l] > arr[ir]) {
SWAP(arr[l],arr[ir])
}
if (arr[l+1] > arr[l]) {
SWAP(arr[l+1],arr[l])
}
i=l+1;
j=ir;
a=arr[l];
for (;;) {
do i++; while (arr[i] < a);
do j--; while (arr[j] > a);
if (j < i) break;
SWAP(arr[i],arr[j]);
}
arr[l]=arr[j];
arr[j]=a;
jstack += 2;
if (jstack > NSTACK) nrerror("NSTACK too small in sort.");
if (ir-i+1 >= j-l) {
istack[jstack]=ir;
istack[jstack-1]=i;
ir=j-1;
} else {
istack[jstack]=j-1;
istack[jstack-1]=l;
l=i;
}
}
}
free_ivector(istack,1,NSTACK);
}
#undef M
#undef NSTACK
#undef SWAP
#undef NRANSI
/* (C) Copr. 1986-92 Numerical Recipes Software )1!. */
import galsim
import pylab as pl
import os
import numpy as np
import gc
import ObservationSim.Instrument._util as _util
from ObservationSim.Instrument.FilterParam import FilterParam
from ObservationSim.Straylight import Straylight
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 'importlib_resources'
import importlib_resources as pkg_resources
class Filter(object):
def __init__(self, filter_id, filter_type, filter_param, ccd_bandpass=None):
self.filter_id = filter_id
self.filter_type = filter_type
self.ccd_bandpass = ccd_bandpass
# Load basic filter parameters.
# Assume t_exp = 150s for limiting/saturation magnitudes.
self._getParam(filter_param, filter_type)
self.bandpass_full, self.bandpass_sub_list = self._get_bandpasses()
self.survey_type = self._getSurveyType()
def _getSurveyType(self):
if self.filter_type in _util.SPEC_FILTERS:
return "spectroscopic"
else:
return "photometric"
def _getParam(self, filter_param, filter_type, filter_id=None):
self.effective_wavelength = filter_param.param[filter_type][0]
self.effective_width = filter_param.param[filter_type][1]
self.blue_limit = filter_param.param[filter_type][2]
self.red_limit = filter_param.param[filter_type][3]
self.efficiency = filter_param.param[filter_type][4]
self.sky_background = filter_param.param[filter_type][5]
self.mag_saturation = filter_param.param[filter_type][6]
self.mag_limiting = filter_param.param[filter_type][7]
self.zodical_spec = None
def is_too_bright(self, mag, margin=-2.5):
return mag <= self.mag_saturation + margin
# return mag <= 14.0
def is_too_dim(self, mag, margin=1.0):
return mag >= self.mag_limiting + margin
def _get_bandpasses(self, filter_dir=None, unit='A'):
if self.filter_id < 7: # Photometric
try:
with pkg_resources.files('ObservationSim.Instrument.data.filters').joinpath(self.filter_type.lower() + '.txt') as filter_file:
self.filter_bandpass = galsim.Bandpass(str(filter_file), wave_type=unit)
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data.filters', self.filter_type.lower() + '.txt') as filter_file:
self.filter_bandpass = galsim.Bandpass(str(filter_file), wave_type=unit)
try:
with pkg_resources.files('ObservationSim.Instrument.data.throughputs').joinpath(self.filter_type.lower() + '_throughput.txt') as filter_file:
bandpass_full = galsim.Bandpass(str(filter_file), wave_type=unit)
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data.throughputs', self.filter_type.lower() + '_throughput.txt') as filter_file:
bandpass_full = galsim.Bandpass(str(filter_file), wave_type=unit)
# bandpass_full = bandpass_full * self.ccd_bandpass
# Get sub-bandpasses
bandpass_sub_list = []
try:
with pkg_resources.files('ObservationSim.Instrument.data.filters').joinpath(self.filter_type.lower() + "_sub.list") as wave_bin_file:
wave_points = open(wave_bin_file).read().splitlines()
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data.filters', self.filter_type.lower() + "_sub.list") as wave_bin_file:
wave_points = open(wave_bin_file).read().splitlines()
for i in range(2, len(wave_points), 2):
blim = max(float(wave_points[i-2])*0.1, bandpass_full.blue_limit)
rlim = min(float(wave_points[i])*0.1, bandpass_full.red_limit)
if blim >= rlim:
continue
bandpass = bandpass_full.truncate(blue_limit=blim, red_limit=rlim)
bandpass_sub_list.append(bandpass)
# print("num of sub-bandpasses for filter#%d(%s) = "%(self.filter_id, self.filter_type), len(bandpass_sub_list), flush=True)
else: # Spectroscopic
sls_lamb = np.linspace(self.blue_limit, self.red_limit, 100)
sls_flux = np.ones_like(sls_lamb)
con_spec = galsim.LookupTable(sls_lamb, sls_flux, interpolant='nearest')
bandpass_full = galsim.Bandpass(con_spec, wave_type=unit)
bandpass_sub_list = []
try:
with pkg_resources.files('ObservationSim.Instrument.data.filters').joinpath(self.filter_type.lower() + "_sub.list") as wave_bin_file:
wave_points = open(wave_bin_file).read().splitlines()
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data.filters', self.filter_type.lower() + "_sub.list") as wave_bin_file:
wave_points = open(wave_bin_file).read().splitlines()
for i in range(2, len(wave_points), 2):
blim = max(float(wave_points[i - 2]) * 0.1, bandpass_full.blue_limit)
rlim = min(float(wave_points[i]) * 0.1, bandpass_full.red_limit)
if blim >= rlim:
continue
bandpass = bandpass_full.truncate(blue_limit=blim, red_limit=rlim)
bandpass_sub_list.append(bandpass)
# print("num of sub-bandpasses for filter#%d(%s) = " % (self.filter_id, self.filter_type), len(bandpass_sub_list), flush=True)
return bandpass_full, bandpass_sub_list
def getPhotonE(self):
return _util.photonEnergy(self.effective_wavelength)
def getSkyNoise(self, exptime, gain=1.):
return self.sky_background * exptime / gain
def setFilterStrayLightPixel(self,jtime = 2460843., sat_pos = np.array([0,0,0]), pointing_radec = np.array([0,0]), sun_pos = np.array([0,0,0])):
sl = Straylight(jtime=jtime, sat_pos=sat_pos, pointing_radec=pointing_radec,sun_pos=sun_pos)
if self.filter_type in _util.SPEC_FILTERS:
s_pix, spec = sl.calculateStrayLightGrating(grating = self.filter_type.upper())
if s_pix>0.8:
s_pix = 0.8
self.sky_background = s_pix
self.zodical_spec = spec
elif self.filter_type.lower() in [x.lower for x in _util.PHOT_FILTERS]:
s_pix = sl.calculateStrayLightFilter(filter=self.filter_type.lower())
if s_pix>1:
s_pix = 1
self.sky_background = s_pix
self.zodical_spec = None
del sl
gc.collect()
def update_limit_saturation_mags(self, exptime=150., psf_fwhm=0.1969, skyFn='sky_emiss_hubble_50_50_A.dat', chip=None):
if self.filter_type in _util.SPEC_FILTERS:
return
if chip is not None:
pix_scale = chip.pix_scale
read_noise = chip.read_noise
dark_noise = chip.dark_noise
full_well = chip.full_well
else:
pix_scale = 0.074
read_noise = 5.0
dark_noise = 0.02
full_well = 90000
throughput_file = self.filter_type.lower() + '_throughput.txt'
self.mag_limiting, self.mag_saturation = _util.calculateLimitMag(psf_fwhm=psf_fwhm, pixelSize=pix_scale, throughputFn=throughput_file, readout=5.0, skyFn=skyFn, darknoise=dark_noise, exTime=exptime, fw=full_well)
print("for filter %s: mag_limiting: %.3f, mag_saturation: %.3f"%(self.filter_type, self.mag_limiting, self.mag_saturation))
import galsim
import numpy as np
class FilterParam(object):
def __init__(self, filter_dir=None, filter_param=None):
self.param = self._filtParam(filter_param)
if filter_dir is not None:
self.filter_dir = filter_dir
else:
self.filter_dir = None
def _filtParam(self, filter_param=None):
"""
TODO: subject to change
Basic parameters of the CSSOS filters.
"""
# filter parameters: name:
# 1) effective wavelength
# 2) effective width
# 3) blue end
# 4) red end
# 5) systematic efficiency:
# tau = quantum efficiency * optical transmission * filter transmission
# 6) sky background: e/pix/s
# 7) saturation magnitude
# 8) dim end magnitude
if filter_param == None:
filtP = {
"NUV": [2867.7, 705.4, 2470.0, 3270.0, 0.1404, 0.004, 15.7, 25.4],
"u": [3601.1, 852.1, 3120.0, 4090.0, 0.2176, 0.021, 16.1, 25.4],
"g": [4754.5, 1569.8, 3900.0, 5620.0, 0.4640, 0.164, 17.2, 26.3],
"r": [6199.8, 1481.2, 5370.0, 7030.0, 0.5040, 0.207, 17.0, 26.0],
"i": [7653.2, 1588.1, 6760.0, 8550.0, 0.4960, 0.212, 16.7, 25.9],
"z": [9600.6, 2490.5, 8240.0, 11000.0, 0.2000, 0.123, 15.7, 25.2],
"y": [10051.0, 1590.6, 9130.0, 11000.0, 0.0960, 0.037, 14.4, 24.4],
"FGS": [5000.0, 8000.0, 3000.0, 11000.0, 0.6500, 0.164, 0., 30.], # [TODO]
"GU": [0.0, 0.0, 2550.0, 4200.0, 1.0, 0.037, 14.0, 26.0],
"GV": [0.0, 0.0, 4000.0, 6500.0, 1.0, 0.037, 14.0, 26.0],
"GI": [0.0, 0.0, 6200.0, 10000.0, 1.0, 0.037, 14.0, 26.0],
}
else:
filtP = filter_param
return filtP
def filtsInterp(self, filtlistn, filtdir="./", unit="A"):
"""
read filters and save into Python dictionary
NOTE: the wavelength unit must be in "Angstrom"
Parameters:
Same as function 'seds'
Return:
Same as function 'seds'
"""
filtParams = self.param
filtype = list(filtParams.keys())
filts = {}
filtlist = filtdir + filtlistn
filtn = open(filtlist).read().splitlines()
for itype in filtype:
ifiltn = filtdir+itype+".dat"
iblim = filtParams[itype][2]
irlim = filtParams[itype][3]
ifilt = galsim.Bandpass(ifiltn,wave_type=unit,blue_limit=iblim,red_limit=irlim)
wave = ifilt.wave_list
ifilt = ifilt.func(wave)
filts[itype] = np.transpose(np.array([wave*10.0,ifilt]))
return filtype, filts
\ No newline at end of file
import galsim
import numpy as np
class FocalPlane(object):
def __init__(self, chip_list=None, survey_type='Photometric', bad_chips=None):
"""Get the focal plane layout
"""
self.nchips = 42
self.ignore_chips = []
if bad_chips == None:
self.bad_chips = []
else:
self.bad_chips = bad_chips
for chip_id in bad_chips:
self.ignore_chips.append(chip_id)
if chip_list is not None:
for i in range(42):
if not (i+1 in chip_list):
self.ignore_chips.append(i+1)
elif survey_type == 'Photometric':
for i in range(5):
self.ignore_chips.append(i+1)
self.ignore_chips.append(i+26)
self.ignore_chips.append(10)
self.ignore_chips.append(21)
for i in range(31, 43):
self.ignore_chips.append(i)
elif survey_type == 'Spectroscopic':
for i in range(6, 26):
if i == 10 or i == 21:
continue
else:
self.ignore_chips.append(i)
for i in range(31, 43):
self.ignore_chips.append(i)
elif survey_type == 'FGS':
for i in range(1, 31):
self.ignore_chips.append(i)
# if config is not None:
# self.nchip_x = config["nchip_x"]
# self.nchip_y = config["nchip_y"]
# self.npix_tot_x = config["npix_tot_x"]
# self.npix_tot_y = config["npix_tot_y"]
# self.npix_gap_x = config["npix_gap_x"]
# self.npix_gap_y = config["npix_gap_y"]
# if "chipLabelIDs" in config:
# self.chipLabelIDs = config["chipLabelIDs"]
# if "bad_chips" in config:
# self.bad_chips = config["bad_chips"]
# else:
self.nchip_x = 6
self.nchip_y = 5
self.npix_tot_x = 59516
self.npix_tot_y = 49752
self.npix_gap_x = (534, 1309)
self.npix_gap_y = 898
self._getCenter()
def _getCenter(self):
self.cen_pix_x = 0
self.cen_pix_y = 0
def getChipLabel(self, chipID):
return str("0%d" % chipID)[-2:]
def isBadChip(self, chipID):
"""Check if chip #(chipID) on the focal plane is bad or not
"""
return (chipID in self.bad_chips)
def isIgnored(self, chipID):
return (chipID in self.ignore_chips)
def getTanWCS(self, ra, dec, img_rot, pix_scale, xcen=None, ycen=None, logger=None):
""" Get the WCS of the image mosaic using Gnomonic/TAN projection
Parameter:
ra, dec: float
(RA, Dec) of pointing of optical axis
img_rot: galsim Angle object
Rotation of image
pix_scale: float
Pixel size in unit of as/pix
Returns:
WCS of the focal plane
"""
if logger is not None:
logger.info(
" Construct the wcs of the entire image mosaic using Gnomonic/TAN projection")
if (xcen == None) or (ycen == None):
xcen = self.cen_pix_x
ycen = self.cen_pix_y
# dudx = -np.cos(img_rot.rad) * pix_scale
# dudy = -np.sin(img_rot.rad) * pix_scale
# dvdx = -np.sin(img_rot.rad) * pix_scale
# dvdy = +np.cos(img_rot.rad) * pix_scale
dudx = -np.cos(img_rot.rad) * pix_scale
dudy = +np.sin(img_rot.rad) * pix_scale
dvdx = -np.sin(img_rot.rad) * pix_scale
dvdy = -np.cos(img_rot.rad) * pix_scale
moscen = galsim.PositionD(x=xcen, y=ycen)
sky_center = galsim.CelestialCoord(
ra=ra*galsim.degrees, dec=dec*galsim.degrees)
affine = galsim.AffineTransform(dudx, dudy, dvdx, dvdy, origin=moscen)
WCS = galsim.TanWCS(affine, sky_center, units=galsim.arcsec)
return WCS
def getSkyCoverage(self, wcs, x0, x1, y0, y1):
"""
The sky coverage of an area
"""
r2d = 180.0/np.pi
s1 = wcs.toWorld(galsim.PositionD(x0, y0))
s2 = wcs.toWorld(galsim.PositionD(x0, y1))
s3 = wcs.toWorld(galsim.PositionD(x1, y0))
s4 = wcs.toWorld(galsim.PositionD(x1, y1))
ra = [s1.ra.rad*r2d, s2.ra.rad*r2d, s3.ra.rad*r2d, s4.ra.rad*r2d]
dec = [s1.dec.rad*r2d, s2.dec.rad*r2d, s3.dec.rad*r2d, s4.dec.rad*r2d]
return galsim.BoundsD(min(ra), max(ra), min(dec), max(dec))
import numpy as np
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 'importlib_resources'
import importlib_resources as pkg_resources
class Telescope(object):
def __init__(self, param=None, optEffCurve_path=None):
self.diameter = 2.0 # in unit of meter
if param is not None:
self.diameter = param["diameter"]
self.pupil_area = np.pi * (0.5 * self.diameter)**2
if optEffCurve_path is not None:
self.efficiency = self._get_efficiency(optEffCurve_path)
else:
try:
with pkg_resources.files('ObservationSim.Instrument.data').joinpath('mirror_ccdnote.txt') as optEffCurve_path:
self.efficiency = self._get_efficiency(optEffCurve_path)
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data', 'mirror_ccdnote.txt') as optEffCurve_path:
self.efficiency = self._get_efficiency(optEffCurve_path)
def _get_efficiency(self, effCurve_path):
""" Read in the efficiency of optics
for each band
Parameters:
effCurve_path: the path for efficiency file
Returns:
opticsEff: a dictionary of efficiency (a scalar) for each band
"""
f = open(effCurve_path, 'r')
for _ in range(2):
header = f.readline()
iline = 0
opticsEff = {}
for line in f:
line = line.strip()
columns = line.split()
opticsEff[str(columns[0])] = float(columns[2])
f.close()
return opticsEff
\ No newline at end of file
from .Telescope import Telescope
from .Filter import Filter
from .FilterParam import FilterParam
from .FocalPlane import FocalPlane
from .Chip import Chip
\ No newline at end of file
import numpy as np
import os
import math
from pylab import *
from scipy import interpolate
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 'importlib_resources'
import importlib_resources as pkg_resources
VC_A = 2.99792458e+18 # speed of light: A/s
VC_M = 2.99792458e+8 # speed of light: m/s
H_PLANK = 6.626196e-27 # Plank constant: erg s
ALL_FILTERS = ["NUV","u", "g", "r", "i","z","y","GU", "GV", "GI", "FGS"]
PHOT_FILTERS = ["NUV", "u", "g", 'r', 'i', 'z', 'y', 'FGS']
SPEC_FILTERS = ["GI", "GV", "GU"]
def rotate_conterclockwise(x0, y0, x, y, angle):
"""
Rotate a point counterclockwise by a given angle around a given origin.
The angle should be given in radians.
"""
angle = np.deg2rad(angle)
qx = x0 + np.cos(angle)*(x - x0) - np.sin(angle) * (y - y0)
qy = y0 + np.sin(angle)*(x - x0) + np.cos(angle) * (y - y0)
return qx, qy
def photonEnergy(lambd):
""" The energy of photon at a given wavelength
Parameter:
lambd: the wavelength in unit of Angstrom
Return:
eph: energy of photon in unit of erg
"""
nu = VC_A / lambd
eph = H_PLANK * nu
return eph
def calculateLimitMag(aperture = 2.0, psf_fwhm = 0.1969,pixelSize = 0.074, pmRation = 0.8, throughputFn = 'i_throughput.txt', readout = 5.0, skyFn= 'sky_emiss_hubble_50_50_A.dat', darknoise = 0.02,exTime = 150, exNum = 1, fw = 90000):
'''
description:
param {*} aperture: unit m, default 2 m
param {*} psf_fwhm: psf fwhm, default 0.1969"
param {*} pixelSize: pixel size, default 0.074"
param {*} pmRation: the ratio of souce flux in the limit mag calculation
param {*} throughputFn: throuput file name
param {*} readout: unit, e-/pixel
param {*} skyFn: sky sed file name, average of hst, 'sky_emiss_hubble_50_50_A.dat'
param {*} darknoise: unit, e-/pixel/s
param {*} exTime: exposure time one time, default 150s
param {*} exNum: exposure number, defautl 1
param {*} fw, full well value( or saturation value),default 90000e-/pixel
return {*} limit mag and saturation mag
'''
try:
with pkg_resources.files('ObservationSim.Instrument.data.throughputs').joinpath(throughputFn) as data_file:
throughput_f = np.loadtxt(data_file)
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data.throughputs', throughputFn) as data_file:
throughput_f = np.loadtxt(data_file)
thr_i = interpolate.interp1d(throughput_f[:,0]/10, throughput_f[:,1]); # wavelength in anstrom
f_s = 200
f_e = 1100
delt_f = 0.5
data_num = int((f_e-f_s)/delt_f+1)
eff = np.zeros([data_num,2])
eff[:,0] = np.arange(f_s,f_e+delt_f,delt_f)
eff[:,1] = thr_i(eff[:,0])
wave = np.arange(f_s,f_e+delt_f,delt_f)
wavey = np.ones(wave.shape[0])
try:
with pkg_resources.files('ObservationSim.Instrument.data.throughputs').joinpath(skyFn) as data_file:
skydata = np.loadtxt(data_file)
except AttributeError:
with pkg_resources.path('ObservationSim.Instrument.data.throughputs', skyFn) as data_file:
skydata = np.loadtxt(data_file)
skydatai = interpolate.interp1d(skydata[:,0]/10, skydata[:,1]*10)
sky_data = np.zeros([data_num,2])
sky_data[:,0] = np.arange(f_s,f_e+delt_f,delt_f)
sky_data[:,1] = skydatai(sky_data[:,0])
flux_sky = trapz((sky_data[:,1])*eff[:,1],sky_data[:,0])
skyPix = flux_sky*pixelSize*pixelSize*pi*(aperture*aperture/4)
###limit mag
r_pix = psf_fwhm*0.7618080243778568/pixelSize # radius RE80, pixel
cnum = math.pi * r_pix * r_pix
sn = 5
d = skyPix*exTime*exNum*cnum + darknoise*exTime*exNum*cnum+readout*readout*cnum*exNum
a=1
b=-sn*sn
c=-sn*sn*d
flux = (-b+sqrt(b*b-4*a*c))/(2*a)/pmRation
limitMag = -2.5*log10(flux/(54799275581.04437 * trapz(wavey*eff[:,1]/wave,wave, 0.1)*exTime*exNum*pi*(aperture/2)*(aperture/2)))
### saturation mag
from astropy.modeling.models import Gaussian2D
m_size = int(20 * psf_fwhm/pixelSize)
if m_size%2 == 0:
m_size + 1
m_cen = m_size//2
psf_sigma = psf_fwhm/2.355/pixelSize
gaussShape = Gaussian2D(1, m_cen, m_cen, psf_sigma, psf_sigma)
yp, xp = np.mgrid[0:m_size, 0:m_size]
psfMap = gaussShape(xp, yp)
maxRatio = np.amax(psfMap)/np.sum(psfMap)
# print(maxRatio)
flux_sat = fw/maxRatio*exNum
satMag = -2.5*log10(flux_sat/(54799275581.04437 * trapz(wavey*eff[:,1]/wave,wave, 0.1)*exTime*exNum*pi*(aperture/2)*(aperture/2)));
return limitMag , satMag
\ No newline at end of file
# Graph from Astro&MB, page 1
251.4 0.5285
254.2 0.4885
257.0 0.4485
259.9 0.4085
264.1 0.3428
269.8 0.2828
272.6 0.2657
276.9 0.2542
281.1 0.2542
285.3 0.2657
291.0 0.2771
299.5 0.2828
316.5 0.3028
329.2 0.3200
349.1 0.3428
366.1 0.3828
371.7 0.4142
371.7 0.4142
376.0 0.4542
383.0 0.4971
390.1 0.5485
398.6 0.6000
405.7 0.6400
412.8 0.6771
424.1 0.7171
438.3 0.7628
448.2 0.7942
448.2 0.7942
448.2 0.7942
448.2 0.7942
469.4 0.8400
490.7 0.8800
490.7 0.8800
511.9 0.9057
541.6 0.9228
565.7 0.9285
586.9 0.9285
620.9 0.9200
647.8 0.9028
680.4 0.8714
721.5 0.8114
741.3 0.7800
758.3 0.7428
771.0 0.7114
786.6 0.6685
800.7 0.6314
813.5 0.5942
822.0 0.5657
836.1 0.5228
850.3 0.4714
860.2 0.4400
860.2 0.4400
868.7 0.4114
877.2 0.3771
887.1 0.3485
901.3 0.3000
915.4 0.2571
926.8 0.2257
938.1 0.1914
955.1 0.1485
976.3 0.1000
997.6 0.06000
1016 0.03714
1033 0.02000
1040 0.01428
1050 0.01142
# Graph from Basic&NIR, page 1
250.0 0.06837
258.5 0.05973
265.6 0.05681
275.5 0.07380
281.2 0.1050
286.9 0.1363
294.0 0.1704
303.9 0.2102
313.9 0.2443
323.8 0.2641
336.6 0.2754
352.3 0.2838
367.9 0.2836
376.4 0.3091
389.2 0.3432
399.2 0.3801
413.4 0.4170
430.4 0.4539
444.6 0.4794
458.8 0.5077
477.3 0.5502
494.4 0.5871
508.6 0.6154
525.6 0.6466
539.8 0.6721
549.8 0.6891
566.8 0.7145
586.7 0.7456
603.8 0.7711
603.8 0.7711
603.8 0.7711
618.0 0.7937
639.3 0.8220
656.3 0.8418
673.4 0.8587
690.4 0.8756
701.8 0.8840
720.3 0.8924
740.2 0.9007
762.9 0.9062
792.8 0.8944
812.6 0.8743
825.4 0.8570
841.1 0.8255
841.1 0.8255
855.3 0.7855
866.6 0.7540
876.6 0.7226
889.4 0.6712
897.9 0.6341
906.4 0.5969
913.5 0.5655
919.2 0.5370
924.9 0.5084
933.4 0.4684
940.5 0.4256
949.1 0.3856
957.6 0.3428
966.1 0.3000
974.6 0.2572
983.2 0.2200
993.1 0.1772
1004 0.1343
1011 0.1058
1024 0.07149
1032 0.04861
1042 0.03141
1051 0.01992
1059 0.01128
# Graph from UV0, page 1
251.4 0.4900
264.2 0.5041
274.1 0.5268
278.4 0.5609
286.9 0.5864
296.8 0.5949
308.2 0.5919
322.4 0.5861
336.6 0.5717
352.3 0.5516
360.8 0.5401
367.9 0.5229
375.0 0.5342
383.5 0.5541
394.9 0.5767
409.1 0.6108
421.9 0.6220
433.3 0.6333
447.5 0.6389
465.9 0.6444
485.8 0.6555
504.3 0.6582
522.8 0.6552
544.1 0.6578
572.5 0.6546
592.4 0.6516
620.8 0.6484
640.7 0.6396
660.6 0.6280
680.5 0.6136
693.3 0.6021
710.3 0.5876
726.0 0.5647
738.8 0.5474
757.2 0.5216
781.4 0.4729
812.6 0.4127
828.3 0.3755
845.3 0.3355
858.1 0.3040
872.3 0.2725
892.2 0.2324
905.0 0.2009
923.5 0.1551
939.1 0.1265
970.4 0.07207
1003 0.03184
1025 0.01450
1038 0.008668
1050 0.00000
{
"31": {
"chip_name": "FGS1A-D1",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": -325.395,
"y_cen": -47.82,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"32": {
"chip_name": "FGS1A-D2",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": -325.395,
"y_cen": 22.7,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"33": {
"chip_name": "FGS1B-D1",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": -325.395,
"y_cen": 93.195,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"34": {
"chip_name": "FGS1B-D2",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": -325.395,
"y_cen": 163.69,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"35": {
"chip_name": "FGS2A-D1",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": 325.395,
"y_cen": 47.82,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"36": {
"chip_name": "FGS2A-D2",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": 325.395,
"y_cen": -22.7,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"37": {
"chip_name": "FGS2B-D1",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": 325.395,
"y_cen": -93.195,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"38": {
"chip_name": "FGS2B-D2",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": 325.395,
"y_cen": -163.69,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"39": {
"chip_name": "FGS3-D1",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": -273.35,
"y_cen": 211.36,
"rotate_angle": 90.0,
"n_psf_samples": 100,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"40": {
"chip_name": "FGS3-D2",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": -202.805,
"y_cen": 211.36,
"rotate_angle": 90.0,
"n_psf_samples": 100,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"41": {
"chip_name": "FGS4-D1",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": 151.03,
"y_cen": -233.885,
"rotate_angle": 90.0,
"n_psf_samples": 100,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"42": {
"chip_name": "FGS4-D2",
"pix_size": 0.0075,
"pix_scale": 0.0555,
"npix_x": 11264,
"npix_y": 7680,
"x_cen": 80.51,
"y_cen": -233.885,
"rotate_angle": 90.0,
"n_psf_samples": 100,
"dark_exptime": 300.0,
"falt_exptime": 150.0,
"readout_time": 0.01,
"df_strength": 2.3,
"bias_level": 2000.0,
"gain": 1.0,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"1": {
"chip_name": "GI-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 251.5,
"y_cen": -202.6,
"rotate_angle": -1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"2": {
"chip_name": "GV-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 251.5,
"y_cen": -101.3,
"rotate_angle": -1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"3": {
"chip_name": "GU-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 251.5,
"y_cen": 0.0,
"rotate_angle": -1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"4": {
"chip_name": "GU-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 251.5,
"y_cen": 101.3,
"rotate_angle": -1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"5": {
"chip_name": "GV-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 251.5,
"y_cen": 202.6,
"rotate_angle": -1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"6": {
"chip_name": "y-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 146.25,
"y_cen": -202.6,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"7": {
"chip_name": "i-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 146.25,
"y_cen": -101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"8": {
"chip_name": "g-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 146.25,
"y_cen": 0.0,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"9": {
"chip_name": "r-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 146.25,
"y_cen": 101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"10": {
"chip_name": "GI-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 154.0,
"y_cen": 202.6,
"rotate_angle": -1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"11": {
"chip_name": "z-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 48.75,
"y_cen": -202.6,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"12": {
"chip_name": "NUV-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 48.75,
"y_cen": -101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"13": {
"chip_name": "NUV-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 48.75,
"y_cen": 0.0,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"14": {
"chip_name": "u-1",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 48.75,
"y_cen": 101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"15": {
"chip_name": "y-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": 48.75,
"y_cen": 202.6,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"16": {
"chip_name": "y-3",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -48.75,
"y_cen": -202.6,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"17": {
"chip_name": "u-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -48.75,
"y_cen": -101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"18": {
"chip_name": "NUV-3",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -48.75,
"y_cen": 0.0,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"19": {
"chip_name": "NUV-4",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -48.75,
"y_cen": 101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"20": {
"chip_name": "z-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -48.75,
"y_cen": 202.6,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"21": {
"chip_name": "GI-3",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -154.0,
"y_cen": -202.6,
"rotate_angle": 1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"22": {
"chip_name": "r-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -146.25,
"y_cen": -101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"23": {
"chip_name": "g-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -146.25,
"y_cen": 0.0,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"24": {
"chip_name": "i-2",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -146.25,
"y_cen": 101.3,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"25": {
"chip_name": "y-4",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -146.25,
"y_cen": 202.6,
"rotate_angle": 0.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"26": {
"chip_name": "GV-3",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -251.5,
"y_cen": -202.6,
"rotate_angle": 1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"27": {
"chip_name": "GU-3",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -251.5,
"y_cen": -101.3,
"rotate_angle": 1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"28": {
"chip_name": "GU-4",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -251.5,
"y_cen": 0.0,
"rotate_angle": 1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"29": {
"chip_name": "GV-4",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -251.5,
"y_cen": 101.3,
"rotate_angle": 1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
},
"30": {
"chip_name": "GI-4",
"pix_size": 0.01,
"pix_scale": 0.074,
"npix_x": 9216,
"npix_y": 9232,
"x_cen": -251.5,
"y_cen": 202.6,
"rotate_angle": 1.0,
"n_psf_samples": 900,
"dark_exptime": 300,
"flat_exptime": 150,
"readout_time": 40,
"df_strength": 2.3,
"bias_level": 500,
"gain": 1.1,
"full_well": 90000,
"prescan_x": 27,
"overscan_x": 71,
"prescan_y": 0,
"overscan_y": 84
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment