Changeset 26891 for trunk/Ohana/src/opihi
- Timestamp:
- Feb 10, 2010, 7:24:46 PM (16 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 14 edited
- 9 copied
-
cmd.astro/mkgauss.c (modified) (2 diffs)
-
cmd.astro/profile.c (modified) (1 diff)
-
cmd.astro/star.c (modified) (1 diff)
-
cmd.basic/Makefile (modified) (1 diff)
-
cmd.basic/init.c (modified) (3 diffs)
-
cmd.basic/nop.c (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/cmd.basic/nop.c )
-
cmd.data/Makefile (modified) (2 diffs)
-
cmd.data/hermitian1d.c (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/cmd.data/hermitian1d.c )
-
cmd.data/hermitian2d.c (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/cmd.data/hermitian2d.c )
-
cmd.data/init.c (modified) (4 diffs)
-
cmd.data/matrix.c (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/cmd.data/matrix.c )
-
cmd.data/svd.c (modified) (1 diff)
-
cmd.data/test/matrix.sh (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/cmd.data/test/matrix.sh )
-
cmd.data/test/svd.sh (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/cmd.data/test/svd.sh )
-
doc/svdcmp_eispack.f (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/doc/svdcmp_eispack.f )
-
include/data.h (modified) (2 diffs)
-
include/pclient.h (modified) (1 diff)
-
lib.data/Makefile (modified) (2 diffs)
-
lib.data/hermitian.c (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/lib.data/hermitian.c )
-
lib.data/svdcmp_bond_raw.c (copied) (copied from branches/eam_branches/20091201/Ohana/src/opihi/lib.data/svdcmp_bond_raw.c )
-
lib.shell/stack_math.c (modified) (4 diffs)
-
pclient/ChildOps.c (modified) (3 diffs)
-
pclient/pclient.c.in (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/mkgauss.c
r7917 r26891 11 11 Buffer *buf; 12 12 13 Xo = Yo = 0; 13 // this should be Nx/2, Ny/2 if not set 14 Xo = Yo = NAN; 14 15 if ((N = get_argument (argc, argv, "-c"))) { 15 16 remove_argument (N, &argc, argv); … … 30 31 Ny = buf[0].header.Naxis[1]; 31 32 33 if (isnan(Xo)) Xo = Nx / 2; 34 if (isnan(Yo)) Yo = Ny / 2; 35 32 36 /* gaussian parameters */ 33 37 Sig_x = atof (argv[2]); -
trunk/Ohana/src/opihi/cmd.astro/profile.c
r20936 r26891 31 31 ResetVector (yvec, OPIHI_FLT, (int)SQ(2*N+1)); 32 32 33 bzero (yvec[0].elements.Flt, (int)SQ(2*N+1)*sizeof(opihi_flt) +1);33 bzero (yvec[0].elements.Flt, (int)SQ(2*N+1)*sizeof(opihi_flt)); 34 34 V = (float *)(buf[0].matrix.buffer); 35 35 Npt = 0; 36 36 Nx = buf[0].matrix.Naxis[0]; 37 for (i = sx - N; i < sx + N; i++) {38 for (j = sy - N; j < sy + N; j++, Npt++) {37 for (i = sx - N; i <= sx + N; i++) { 38 for (j = sy - N; j <= sy + N; j++, Npt++) { 39 39 yvec[0].elements.Flt[Npt] = V[i + j*Nx]; 40 xvec[0].elements.Flt[Npt] = hypot (i - sx, j- sy);40 xvec[0].elements.Flt[Npt] = hypot (i + 0.5 - sx, j + 0.5 - sy); 41 41 } 42 42 } -
trunk/Ohana/src/opihi/cmd.astro/star.c
r7917 r26891 24 24 if ((argc != 4) && (argc != 5)) { 25 25 gprint (GP_ERR, "USAGE: star (buffer) x y [dx] [-border N] [-sat cnts]\n"); 26 gprint (GP_ERR, " dx is the aperture diameter, but is adjusted up to the next odd number\n"); 26 27 return (FALSE); 27 28 } -
trunk/Ohana/src/opihi/cmd.basic/Makefile
r25965 r26891 39 39 $(SRC)/mkdir.$(ARCH).o \ 40 40 $(SRC)/module.$(ARCH).o \ 41 $(SRC)/nop.$(ARCH).o \ 41 42 $(SRC)/output.$(ARCH).o \ 42 43 $(SRC)/quit.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.basic/init.c
r25965 r26891 25 25 int mkdir_opihi PROTO((int, char **)); 26 26 int module PROTO((int, char **)); 27 int nop PROTO((int, char **)); 27 28 int output PROTO((int, char **)); 28 29 int pwd PROTO((int, char **)); … … 66 67 {1, "?", list_help, "list commands *"}, 67 68 {1, "??", list_vars, "list variables *"}, 69 {1, "#", nop, "a NOP function"}, 68 70 {1, "local", local, "define local variables"}, 69 71 {1, "macro", macro, "deal with the macros *"}, … … 71 73 {1, "mkdir", mkdir_opihi, "built-in mkdir command"}, 72 74 {1, "module", module, "load script file from the modules directories"}, 75 {1, "nop", nop, "a NOP function"}, 73 76 {1, "output", output, "redirect output to file"}, 74 77 {1, "pwd", pwd, "print current working directory"}, -
trunk/Ohana/src/opihi/cmd.data/Makefile
r25757 r26891 53 53 $(SRC)/ungridify.$(ARCH).o \ 54 54 $(SRC)/histogram.$(ARCH).o \ 55 $(SRC)/hermitian1d.$(ARCH).o \ 56 $(SRC)/hermitian2d.$(ARCH).o \ 55 57 $(SRC)/imcut.$(ARCH).o \ 56 58 $(SRC)/imhist.$(ARCH).o \ … … 69 71 $(SRC)/load.$(ARCH).o \ 70 72 $(SRC)/lookup.$(ARCH).o \ 73 $(SRC)/matrix.$(ARCH).o \ 71 74 $(SRC)/mkrgb.$(ARCH).o \ 72 75 $(SRC)/mcreate.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r25757 r26891 42 42 int ungridify PROTO((int, char **)); 43 43 int histogram PROTO((int, char **)); 44 int hermitian1d PROTO((int, char **)); 45 int hermitian2d PROTO((int, char **)); 44 46 int imcut PROTO((int, char **)); 45 47 int imhist PROTO((int, char **)); … … 58 60 int load PROTO((int, char **)); 59 61 int lookup PROTO((int, char **)); 62 int matrix PROTO((int, char **)); 60 63 int mkrgb PROTO((int, char **)); 61 64 int mcreate PROTO((int, char **)); … … 172 175 {1, "header", header, "print image header"}, 173 176 {1, "histogram", histogram, "generate histogram from vector"}, 177 {1, "hermitian1d", hermitian1d, "generate 1-D Hermitian Polynomial"}, 178 {1, "hermitian2d", hermitian2d, "generate 2-D Hermitian Polynomial"}, 174 179 {1, "imbin", rebin, "rebin image data by factor of N"}, 175 180 {1, "imclip", imclip, "clip values in an image to be within a range"}, … … 195 200 {1, "minterp", minterp, "interpolate image pixels"}, 196 201 {1, "iminterp", minterp, "interpolate image pixels"}, 202 {1, "matrix", matrix, "matrix math operations"}, 197 203 {1, "mkrgb", mkrgb, "convert 3 images to rgb jpeg (use Kapa for better control)"}, 198 204 {1, "mset", mset, "insert a vector in an image"}, -
trunk/Ohana/src/opihi/cmd.data/svd.c
r20936 r26891 57 57 /* use a bcopy instead? */ 58 58 59 // try C.R. Bond's version -- requires matrices in the form A[row][col] not A[row*Ncol + col] 60 if (1) { 61 int j; 62 double **a, **u, **v, *q; 63 ALLOCATE (a, double *, Ny); 64 ALLOCATE (u, double *, Ny); 65 ALLOCATE (v, double *, Ny); 66 for (i = 0; i < Ny; i++) { 67 ALLOCATE (a[i], double, Nx); 68 ALLOCATE (u[i], double, Nx); 69 ALLOCATE (v[i], double, Nx); 70 } 71 ALLOCATE (q, double, Nx); 72 73 for (j = 0; j < Ny; j++) { 74 for (i = 0; i < Nx; i++) { 75 a[j][i] = A[j*Nx + i]; 76 u[j][i] = 0; 77 v[j][i] = 0; 78 } 79 } 80 for (i = 0; i < Nx; i++) { 81 q[i] = 0; 82 } 83 84 status = svdcmp_bond_raw (Ny, Nx, 1, 1, FLT_EPSILON, 1e-6, a, q, u, v); 85 fprintf (stderr, "status: %d\n", status); 86 87 // copy u q v back to U W V: 88 for (j = 0; j < Ny; j++) { 89 for (i = 0; i < Nx; i++) { 90 U[j*Nx + i] = u[j][i]; 91 V[j*Nx + i] = v[j][i]; 92 } 93 } 94 for (i = 0; i < Nx; i++) { 95 W[i] = q[i]; 96 } 97 98 for (j = 0; j < Ny; j++) { 99 free(a[j]); 100 free(u[j]); 101 free(v[j]); 102 } 103 free (a); 104 free (u); 105 free (v); 106 free (q); 107 108 return TRUE; 109 } 110 59 111 status = svdcmp (U, W, V, Nx, Ny); 60 112 if (!status) { -
trunk/Ohana/src/opihi/include/data.h
r26258 r26891 89 89 int svdcmp (float *a, opihi_flt *w, float *v, int Nx, int Ny); 90 90 91 /* in svdcmp_bond_raw.c */ 92 int svdcmp_bond_raw(int m, int n, int withu, int withv, double eps, double tol, double **a, double *q, double **u, double **v); 93 91 94 /* mrqmin.c */ 92 95 opihi_flt mrqcof (opihi_flt *x, opihi_flt *y, opihi_flt *dy, int Npts, … … 162 165 void FreeBooks (void); 163 166 167 /* hermitian functions */ 168 double hermitian_polynomial (double x, int order); 169 double hermitian_00(double x); 170 double hermitian_01(double x); 171 double hermitian_02(double x); 172 double hermitian_03(double x); 173 double hermitian_04(double x); 174 double hermitian_05(double x); 175 double hermitian_06(double x); 176 double hermitian_07(double x); 177 double hermitian_08(double x); 178 double hermitian_09(double x); 179 double hermitian_10(double x); 180 164 181 # endif -
trunk/Ohana/src/opihi/include/pclient.h
r21153 r26891 52 52 void FreePclient (void); 53 53 void gotsignal (int signum); 54 void pipe_signal (int signum); 55 void pipe_signal_clear(void); 54 56 55 57 # define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec)) -
trunk/Ohana/src/opihi/lib.data/Makefile
r16117 r26891 20 20 $(SDIR)/fft.$(ARCH).o \ 21 21 $(SDIR)/svdcmp.$(ARCH).o \ 22 $(SDIR)/svdcmp_bond_raw.$(ARCH).o \ 22 23 $(SDIR)/convert.$(ARCH).o \ 23 24 $(SDIR)/bracket.$(ARCH).o \ … … 27 28 $(SDIR)/precess.$(ARCH).o \ 28 29 $(SDIR)/starfuncs.$(ARCH).o \ 30 $(SDIR)/hermitian.$(ARCH).o \ 29 31 $(SDIR)/gaussian.$(ARCH).o \ 30 32 $(SDIR)/graphtools.$(ARCH).o \ -
trunk/Ohana/src/opihi/lib.shell/stack_math.c
r20936 r26891 628 628 629 629 # define MS_FUNC(OP) { \ 630 if (V2->type == ' s') { \630 if (V2->type == 'S') { \ 631 631 opihi_flt M2 = V2[0].FltValue; \ 632 632 for (i = 0; i < Nx*Ny; i++, out++, M1++) { \ … … 635 635 break; \ 636 636 } \ 637 if (V2->type == ' S') { \637 if (V2->type == 's') { \ 638 638 opihi_int M2 = V2[0].IntValue; \ 639 639 for (i = 0; i < Nx*Ny; i++, out++, M1++) { \ … … 704 704 705 705 # define SM_FUNC(OP) { \ 706 if (V1->type == ' s') { \706 if (V1->type == 'S') { \ 707 707 opihi_flt M1 = V1[0].FltValue; \ 708 708 for (i = 0; i < Nx*Ny; i++, out++, M2++) { \ … … 711 711 break; \ 712 712 } \ 713 if (V1->type == ' S') { \713 if (V1->type == 's') { \ 714 714 opihi_int M1 = V1[0].IntValue; \ 715 715 for (i = 0; i < Nx*Ny; i++, out++, M2++) { \ -
trunk/Ohana/src/opihi/pclient/ChildOps.c
r26257 r26891 1 1 # include "pclient.h" 2 # include <sys/ioctl.h>3 # include <sys/types.h>4 # include <unistd.h>2 # include <sys/ioctl.h> 3 # include <sys/types.h> 4 # include <unistd.h> 5 5 // #include <stropts.h> 6 6 … … 67 67 case 0: /* pipe is closed */ 68 68 /** change child state? **/ 69 pipe_signal_clear(); 69 70 break; 70 71 default: /* data in pipe */ … … 81 82 case 0: /* pipe is closed */ 82 83 /** change child state? **/ 84 pipe_signal_clear(); 83 85 break; 84 86 default: /* data in pipe */ -
trunk/Ohana/src/opihi/pclient/pclient.c.in
r18123 r26891 46 46 47 47 /* ignore the history file. to change this, see, eg, mana.c */ 48 signal (SIGPIPE, gotsignal); 48 49 /* We do not want pclient to exit just because the connection to the 50 child process is broken. However, if the connection to the parent 51 process is broken, we should exit. To handle this, we define 52 pipe_signal() which tracks the number of times it has been called. 53 Every time an I/O operation on the child file descriptor raises this signal, 54 we need to manage the crashed child and then clear the count. Signals raised by 55 I/O to the parent do not result in clearing the count. If the count passes a maximum, 56 we exit pclient */ 57 58 signal (SIGPIPE, pipe_signal); 49 59 signal (SIGTSTP, gotsignal); 50 60 signal (SIGTTIN, gotsignal); … … 67 77 } 68 78 79 static int Npipe = 0; 80 81 void pipe_signal (int signum) { 82 Npipe ++; 83 if (Npipe > 100) { 84 exit (5); 85 } 86 gprint (GP_ERR, "closed pipe : did child process exit unexpectedly?\n"); 87 return; 88 } 89 90 void pipe_signal_clear(void) { 91 Npipe = 0; 92 } 93 69 94 void gotsignal (int signum) { 70 95 gprint (GP_ERR, "got signal : %d\n", signum);
Note:
See TracChangeset
for help on using the changeset viewer.
