Changeset 25757
- Timestamp:
- Oct 2, 2009, 3:15:42 PM (17 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 5 deleted
- 93 edited
- 16 copied
-
addstar/src/ConfigInit.c (modified) (1 diff)
-
addstar/src/ConfigInit_skycells.c (modified) (1 diff)
-
addstar/src/addstar.c (modified) (1 diff)
-
addstar/src/addstard.c (modified) (1 diff)
-
addstar/src/addstart.c (modified) (1 diff)
-
addstar/src/load2mass.c (modified) (1 diff)
-
addstar/src/sedstar.c (modified) (1 diff)
-
delstar/src/ConfigInit.c (modified) (1 diff)
-
delstar/src/delete_imagefile.c (modified) (1 diff)
-
delstar/src/delete_imagename.c (modified) (1 diff)
-
delstar/src/delete_times.c (modified) (1 diff)
-
dvomerge/src/dvomerge.c (modified) (4 diffs)
-
dvosplit/src/ConfigInit.c (modified) (1 diff)
-
dvosplit/src/dvosplit.c (modified) (2 diffs)
-
gastro/src/getptolemy.c (modified) (1 diff)
-
gastro2/src/getptolemy.c (modified) (1 diff)
-
getstar/src/ConfigInit.c (modified) (1 diff)
-
getstar/src/ConfigInit_coords.c (modified) (1 diff)
-
getstar/src/ConfigInit_extract.c (modified) (1 diff)
-
getstar/src/ConfigInit_overlaps.c (modified) (1 diff)
-
getstar/src/getstar.c (modified) (1 diff)
-
imregister/base/ConfigInit.c (modified) (1 diff)
-
imregister/imphot/ConfigInit.c (modified) (1 diff)
-
kapa2/Makefile (modified) (2 diffs)
-
kapa2/include/constants.h (modified) (1 diff)
-
kapa2/include/prototypes.h (modified) (2 diffs)
-
kapa2/include/structures.h (modified) (2 diffs)
-
kapa2/src/ButtonFunctions.c (modified) (3 diffs)
-
kapa2/src/Center.c (modified) (1 diff)
-
kapa2/src/CheckPipe.c (modified) (1 diff)
-
kapa2/src/CheckVisual.c (modified) (12 diffs)
-
kapa2/src/CheckVisual.test.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/kapa2/src/CheckVisual.test.c )
-
kapa2/src/CreateZoom16.c (deleted)
-
kapa2/src/CreateZoom24.c (deleted)
-
kapa2/src/CreateZoom32.c (deleted)
-
kapa2/src/CreateZoom8.c (deleted)
-
kapa2/src/CursorOps.c (modified) (9 diffs)
-
kapa2/src/DragColorbar.c (modified) (5 diffs)
-
kapa2/src/Image.c (modified) (3 diffs)
-
kapa2/src/InterpretKeys.c (modified) (7 diffs)
-
kapa2/src/JPEGit24.c (modified) (2 diffs)
-
kapa2/src/LoadPicture.c (modified) (3 diffs)
-
kapa2/src/MakeColormap.c (modified) (1 diff)
-
kapa2/src/PSOverlay.c (modified) (1 diff)
-
kapa2/src/PaintOverlay.c (modified) (2 diffs)
-
kapa2/src/Relocate.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/kapa2/src/Relocate.c )
-
kapa2/src/Remap16.c (modified) (7 diffs)
-
kapa2/src/Remap24.c (modified) (6 diffs)
-
kapa2/src/Remap32.c (modified) (8 diffs)
-
kapa2/src/Remap8.c (modified) (6 diffs)
-
kapa2/src/Reorient.c (modified) (3 diffs)
-
kapa2/src/SetColorScale.c (modified) (1 diff)
-
kapa2/src/SetColormap.c (modified) (1 diff)
-
kapa2/src/SetUpGraphic.c (modified) (1 diff)
-
kapa2/src/StatusBox.c (modified) (1 diff)
-
kapa2/src/UpdatePointer.c (modified) (2 diffs)
-
kapa2/src/UpdateStatusBox.c (modified) (1 diff)
-
kapa2/src/bDrawOverlay.c (modified) (1 diff)
-
kapa2/src/sort.c (deleted)
-
kapa2/test/overlay.sh (copied) (copied from branches/eam_branches/20090715/Ohana/src/kapa2/test/overlay.sh )
-
libdvo/doc/locking.txt (copied) (copied from branches/eam_branches/20090715/Ohana/src/libdvo/doc/locking.txt )
-
libdvo/include/dvo.h (modified) (2 diffs)
-
libdvo/src/LoadPhotcodes.c (modified) (1 diff)
-
libdvo/src/coordops.c (modified) (1 diff)
-
libdvo/src/dvo_catalog.c (modified) (2 diffs)
-
libdvo/src/dvo_image.c (modified) (1 diff)
-
libdvo/src/skyregion_io.c (modified) (5 diffs)
-
libkapa/include/kapa.h (modified) (1 diff)
-
libkapa/src/KapaWindow.c (modified) (1 diff)
-
libohana/include/ohana.h (modified) (1 diff)
-
libohana/src/findexec.c (modified) (4 diffs)
-
markrock/src/ConfigInit.c (modified) (1 diff)
-
markrock/src/markrock.c (modified) (1 diff)
-
markstar/src/ConfigInit.c (modified) (1 diff)
-
mosastro/src/getptolemy.c (modified) (1 diff)
-
opihi/cmd.astro/Makefile (modified) (2 diffs)
-
opihi/cmd.astro/cdot.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/cdot.c )
-
opihi/cmd.astro/cgrid.c (modified) (2 diffs)
-
opihi/cmd.astro/elliprofile.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/elliprofile.c )
-
opihi/cmd.astro/galcontour.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/galcontour.c )
-
opihi/cmd.astro/galprofiles.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/galprofiles.c )
-
opihi/cmd.astro/galradbins.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/galradbins.c )
-
opihi/cmd.astro/galradius.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/galradius.c )
-
opihi/cmd.astro/galsectors.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/galsectors.c )
-
opihi/cmd.astro/init.c (modified) (4 diffs)
-
opihi/cmd.astro/mksersic.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/mksersic.c )
-
opihi/cmd.astro/petrosian.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.astro/petrosian.c )
-
opihi/cmd.astro/region.c (modified) (3 diffs)
-
opihi/cmd.basic/substr.c (modified) (1 diff)
-
opihi/cmd.data/Makefile (modified) (4 diffs)
-
opihi/cmd.data/init.c (modified) (4 diffs)
-
opihi/cmd.data/relocate.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.data/relocate.c )
-
opihi/cmd.data/subset.c (modified) (3 diffs)
-
opihi/cmd.data/tvcolors.c (modified) (1 diff)
-
opihi/cmd.data/vellipse.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.data/vellipse.c )
-
opihi/cmd.data/vgroup.c (copied) (copied from branches/eam_branches/20090715/Ohana/src/opihi/cmd.data/vgroup.c )
-
opihi/dvo/Makefile (modified) (1 diff)
-
opihi/dvo/gimages.c (modified) (2 diffs)
-
opihi/dvo/imbox.c (modified) (4 diffs)
-
opihi/dvo/init.c (modified) (1 diff)
-
opihi/dvo/photometry.c (modified) (1 diff)
-
opihi/dvo/region_list.c (modified) (1 diff)
-
opihi/dvo/skycoverage.c (modified) (6 diffs)
-
opihi/lib.data/mrqmin.c (modified) (3 diffs)
-
photdbc/src/ConfigInit.c (modified) (1 diff)
-
photdbc/src/photdbc.c (modified) (1 diff)
-
relastro/src/ConfigInit.c (modified) (1 diff)
-
relastro/src/load_images.c (modified) (1 diff)
-
relastro/src/relastro_objects.c (modified) (1 diff)
-
relphot/src/ConfigInit.c (modified) (1 diff)
-
relphot/src/load_images.c (modified) (1 diff)
-
relphot/src/relphot_objects.c (modified) (1 diff)
-
tools/src/mktemp.c (modified) (1 diff)
-
uniphot/src/ConfigInit.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/ConfigInit.c
r24973 r25757 180 180 /* XXX this does not yet write out the master photcode table */ 181 181 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 182 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {182 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 183 183 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 184 184 exit (1); -
trunk/Ohana/src/addstar/src/ConfigInit_skycells.c
r16061 r25757 55 55 /* XXX this does not yet write out the master photcode table */ 56 56 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 57 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {57 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 58 58 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 59 59 exit (1); -
trunk/Ohana/src/addstar/src/addstar.c
r21508 r25757 25 25 options = args (argc, argv, options); 26 26 27 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);27 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 28 28 if (sky == NULL) { 29 29 fprintf (stderr, "ERROR: unable to load sky table data\n"); -
trunk/Ohana/src/addstar/src/addstard.c
r6236 r25757 12 12 13 13 /* store the sky table in a global for internal use */ 14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 15 15 SkyTableSetFilenames (ServerSky, CATDIR, "cpt"); 16 16 -
trunk/Ohana/src/addstar/src/addstart.c
r10939 r25757 12 12 13 13 /* store the sky table in a global for internal use */ 14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 15 15 SkyTableSetFilenames (ServerSky, CATDIR, "cpt"); 16 16 -
trunk/Ohana/src/addstar/src/load2mass.c
r24977 r25757 16 16 17 17 // load the full sky description table: 18 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);18 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 19 19 SkyTableSetFilenames (sky, CATDIR, "cpt"); 20 20 -
trunk/Ohana/src/addstar/src/sedstar.c
r15743 r25757 15 15 options = args_sedstar (argc, argv, options); 16 16 17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 18 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 19 19 -
trunk/Ohana/src/delstar/src/ConfigInit.c
r12332 r25757 45 45 /* XXX this does not yet write out the master photcode table */ 46 46 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 47 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {47 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 48 48 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 49 49 exit (1); -
trunk/Ohana/src/delstar/src/delete_imagefile.c
r15743 r25757 12 12 13 13 /* load sky from correct table */ 14 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);14 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 15 15 SkyTableSetFilenames (sky, CATDIR, "cpt"); 16 16 -
trunk/Ohana/src/delstar/src/delete_imagename.c
r17245 r25757 15 15 16 16 /* load sky from correct table */ 17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 18 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 19 19 -
trunk/Ohana/src/delstar/src/delete_times.c
r15743 r25757 15 15 16 16 /* load sky from correct table */ 17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 18 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 19 19 -
trunk/Ohana/src/dvomerge/src/dvomerge.c
r24750 r25757 24 24 // the first input define the photcode table & db layout 25 25 sprintf (filename, "%s/Photcodes.dat", input1); 26 if (!LoadPhotcodes (filename, NULL )) {26 if (!LoadPhotcodes (filename, NULL, FALSE)) { 27 27 fprintf (stderr, "error loading photcode table %s\n", filename); 28 28 exit (1); … … 30 30 // save the photcodes in the output catdir 31 31 sprintf (filename, "%s/Photcodes.dat", output); 32 if (!check_file_access (filename, TRUE, TRUE )) {32 if (!check_file_access (filename, TRUE, TRUE, TRUE)) { 33 33 fprintf (stderr, "error creating output catdir %s\n", output); 34 34 exit (1); … … 40 40 41 41 // load the sky table for the existing database 42 insky1 = SkyTableLoadOptimal (input1, NULL, NULL, SKY_DEPTH_HST, VERBOSE);42 insky1 = SkyTableLoadOptimal (input1, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 43 43 SkyTableSetFilenames (insky1, input1, "cpt"); 44 44 45 insky2 = SkyTableLoadOptimal (input2, NULL, NULL, SKY_DEPTH_HST, VERBOSE);45 insky2 = SkyTableLoadOptimal (input2, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 46 46 SkyTableSetFilenames (insky2, input2, "cpt"); 47 47 48 48 // generate an output table populated at the desired depth 49 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, SKY_DEPTH, VERBOSE);49 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 50 50 SkyTableSetFilenames (outsky, output, "cpt"); 51 51 … … 117 117 // save the output sky table copy 118 118 sprintf (filename, "%s/SkyTable.fits", output); 119 check_file_access (filename, TRUE, VERBOSE);119 check_file_access (filename, TRUE, TRUE, VERBOSE); 120 120 if (!SkyTableSave (outsky, filename)) { 121 121 fprintf (stderr, "ERROR: failed to save sky table for %s\n", output); -
trunk/Ohana/src/dvosplit/src/ConfigInit.c
r24753 r25757 33 33 /* XXX this does not yet write out the master photcode table */ 34 34 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 35 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {35 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 36 36 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 37 37 exit (1); -
trunk/Ohana/src/dvosplit/src/dvosplit.c
r15746 r25757 18 18 19 19 // load the sky table for the existing database 20 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, SKY_DEPTH_HST, VERBOSE);20 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, SKY_DEPTH_HST, VERBOSE); 21 21 SkyTableSetFilenames (sky, CATDIR, "cpt"); 22 22 … … 79 79 // save sky table copy 80 80 sprintf (filename, "%s/SkyTable.fits", CATDIR); 81 check_file_access (filename, TRUE, VERBOSE);81 check_file_access (filename, TRUE, TRUE, VERBOSE); 82 82 if (!SkyTableSave (sky, filename)) { 83 83 fprintf (stderr, "ERROR: failed to save sky table for %s\n", CATDIR); -
trunk/Ohana/src/gastro/src/getptolemy.c
r16810 r25757 19 19 20 20 /* load regions from GSC table, restrict to patch */ 21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, FALSE, SKY_DEPTH_HST, VERBOSE); 22 22 SkyTableSetFilenames (sky, CATDIR, "cpt"); 23 23 skylist = SkyListByPatch (sky, -1, &patch); -
trunk/Ohana/src/gastro2/src/getptolemy.c
r16810 r25757 21 21 22 22 /* load regions from GSC table, restrict to patch */ 23 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);23 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, FALSE, SKY_DEPTH_HST, VERBOSE); 24 24 SkyTableSetFilenames (sky, CATDIR, "cpt"); 25 25 skylist = SkyListByPatch (sky, -1, &patch); -
trunk/Ohana/src/getstar/src/ConfigInit.c
r15543 r25757 34 34 /* XXX this does not yet write out the master photcode table */ 35 35 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 36 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {36 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 37 37 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 38 38 exit (1); -
trunk/Ohana/src/getstar/src/ConfigInit_coords.c
r24914 r25757 35 35 /* XXX this does not yet write out the master photcode table */ 36 36 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 38 38 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 39 39 exit (1); -
trunk/Ohana/src/getstar/src/ConfigInit_extract.c
r12840 r25757 35 35 /* XXX this does not yet write out the master photcode table */ 36 36 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 38 38 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 39 39 exit (1); -
trunk/Ohana/src/getstar/src/ConfigInit_overlaps.c
r12774 r25757 35 35 /* XXX this does not yet write out the master photcode table */ 36 36 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, FALSE)) { 38 38 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 39 39 exit (1); -
trunk/Ohana/src/getstar/src/getstar.c
r20984 r25757 13 13 set_db (&db); 14 14 15 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);15 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 16 16 if (!sky) exit (1); 17 17 -
trunk/Ohana/src/imregister/base/ConfigInit.c
r12332 r25757 105 105 /* XXX this does not yet write out the master photcode table */ 106 106 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir); 107 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {107 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 108 108 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 109 109 exit (1); -
trunk/Ohana/src/imregister/imphot/ConfigInit.c
r12332 r25757 101 101 /* XXX this does not yet write out the master photcode table */ 102 102 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 103 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {103 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 104 104 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 105 105 exit (1); -
trunk/Ohana/src/kapa2/Makefile
r16270 r25757 48 48 $(SRC)/Layout.$(ARCH).o $(SRC)/Sections.$(ARCH).o \ 49 49 $(SRC)/Graphs.$(ARCH).o $(SRC)/SetGraphSize.$(ARCH).o \ 50 $(SRC)/Resize.$(ARCH).o $(SRC)/ ErasePlots.$(ARCH).o\51 $(SRC)/Erase Image.$(ARCH).o $(SRC)/SetToolbox.$(ARCH).o \50 $(SRC)/Resize.$(ARCH).o $(SRC)/Relocate.$(ARCH).o \ 51 $(SRC)/ErasePlots.$(ARCH).o $(SRC)/EraseImage.$(ARCH).o \ 52 52 $(SRC)/EraseCurrentPlot.$(ARCH).o $(SRC)/EraseSections.$(ARCH).o \ 53 $(SRC)/SetToolbox.$(ARCH).o \ 53 54 $(SRC)/SetSection.$(ARCH).o $(SRC)/DefineSection.$(ARCH).o \ 54 55 $(SRC)/SetLimits.$(ARCH).o $(SRC)/SetFont.$(ARCH).o \ … … 79 80 $(SRC)/ColorHistogram.$(ARCH).o $(SRC)/CreateWide.$(ARCH).o 80 81 81 #$(SRC)/CreateZoom8.$(ARCH).o $(SRC)/CreateZoom16.$(ARCH).o \82 #$(SRC)/CreateZoom24.$(ARCH).o $(SRC)/CreateZoom32.$(ARCH).o \83 84 82 OBJ = $(KAPA) 85 83 -
trunk/Ohana/src/kapa2/include/constants.h
r16011 r25757 11 11 12 12 # define NCHANNELS 3 13 # define NPIXELS_DYNAMIC 12813 # define NPIXELS_DYNAMIC 4600 14 14 15 15 // XXX for the moment, this is set to match the values in SetColorScale3D_CC -
trunk/Ohana/src/kapa2/include/prototypes.h
r21153 r25757 55 55 int LoadTextlines PROTO((int sock)); 56 56 int Resize PROTO((int sock)); 57 int Relocate PROTO((int sock)); 57 58 int GetLimits PROTO((int sock)); 58 59 int SetLimits PROTO((int sock)); … … 178 179 void Image_to_Picture PROTO((double *x1, double *y1, double x2, double y2, Picture *picture)); 179 180 void Image_to_Screen PROTO((double *x1, double *y1, double x2, double y2, Picture *picture)); 180 void Picture_Lower PROTO((int *i_start, int *j_start, Matrix *matrix, Picture *picture));181 void Picture_Upper PROTO((int *i_end, int *j_end, Matrix *matrix, Picture *picture));181 void Picture_Lower PROTO((int *i_start, int *j_start, int *I_start, int *J_start, Matrix *matrix, Picture *picture)); 182 void Picture_Upper PROTO((int *i_end, int *j_end, int i_start, int j_start, Matrix *matrix, Picture *picture)); 182 183 183 184 void DragColorbar PROTO((Graphic *graphic, KapaImageWidget *image, XButtonEvent *mouse_event)); -
trunk/Ohana/src/kapa2/include/structures.h
r21153 r25757 21 21 Window window; 22 22 Visual *visual; 23 int visualclass; // is visual dynamic? (XXX change name?)23 int dynamicColors; // is visual dynamic? 24 24 int Nbits; // pixel depth in bits (8, 16, 24, 32) 25 25 GC gc; … … 94 94 int DX, DY; // size of displayed picture (must be updated with new images...) 95 95 int expand; // zoomscale 96 double X , Y; // center of image in picture96 double Xc, Yc; // center of image in picture 97 97 char flipx, flipy; // parity (0 = +; 1 = -) 98 98 XImage *pix; -
trunk/Ohana/src/kapa2/src/ButtonFunctions.c
r21153 r25757 44 44 int Recenter (Graphic *graphic, KapaImageWidget *image) { 45 45 46 image[0].picture.X = 0.5*image[0].image[0].matrix.Naxis[0];47 image[0].picture.Y = 0.5*image[0].image[0].matrix.Naxis[1];46 image[0].picture.Xc = 0.5*image[0].image[0].matrix.Naxis[0]; 47 image[0].picture.Yc = 0.5*image[0].image[0].matrix.Naxis[1]; 48 48 49 49 Remap (graphic, image); … … 56 56 57 57 image[0].picture.expand = 1; 58 image[0].zoom.expand = 5; 58 59 Remap (graphic, image); 59 60 Refresh (); … … 64 65 int RecenterRescale (Graphic *graphic, KapaImageWidget *image) { 65 66 66 image[0].picture.X = 0.5*image[0].image[0].matrix.Naxis[0];67 image[0].picture.Y = 0.5*image[0].image[0].matrix.Naxis[1];67 image[0].picture.Xc = 0.5*image[0].image[0].matrix.Naxis[0]; 68 image[0].picture.Yc = 0.5*image[0].image[0].matrix.Naxis[1]; 68 69 image[0].picture.expand = 1; 70 image[0].zoom.expand = 5; 69 71 70 72 Remap (graphic, image); -
trunk/Ohana/src/kapa2/src/Center.c
r21060 r25757 16 16 if (image == NULL) return (TRUE); 17 17 18 image[0].picture.X = X; 19 image[0].picture.Y = Y; 18 // enforce integer center here? 19 image[0].picture.Xc = X; 20 image[0].picture.Yc = Y; 20 21 if ((zoom != 0) && (zoom != -1)) { 21 22 image[0].picture.expand = zoom; 23 image[0].zoom.expand = MIN(image[0].zoom.dx / 5.5, MAX(5, 2*zoom)); 22 24 } 23 25 -
trunk/Ohana/src/kapa2/src/CheckPipe.c
r21060 r25757 131 131 } 132 132 133 if (!strcmp (word, "MOVE")) { 134 status = Relocate (sock); 135 KiiSendCommand (sock, 4, "DONE"); 136 FINISHED (status); 137 } 138 133 139 if (!strcmp (word, "GLIM")) { 134 140 GetLimits (sock); -
trunk/Ohana/src/kapa2/src/CheckVisual.c
r21153 r25757 10 10 11 11 int i, Nfound, N; 12 int isColor, isDefault , isDynamic;12 int isColor, isDefault; 13 13 XVisualInfo *visual_list, visual_temp; 14 14 unsigned long planes[3]; … … 34 34 } 35 35 36 // skip the default and the PseudoColor visuals, go for TrueColor first37 # if (0)38 /* check default visual first */39 for (i = 0; (i < Nfound) && (graphic[0].visual != visual_list[i].visual); i++);40 if (i == Nfound) {41 fprintf (stderr, "default visual not found??\n");42 exit (0);43 }44 # endif45 46 36 // set these based on selected visual 47 isColor = isDefault = isDynamic = FALSE; 48 49 # if (0) 50 // attempt to select the most desirable type of visual: Default as PseudoColor (XXX is it still true?) 51 if (DEBUG) fprintf (stderr, "default visual class is %d\n", visual_list[i].class); 52 if (visual_list[i].class == PseudoColor) { 53 isColor = isDefault = isDynamic = TRUE; 54 graphic[0].visual = visual_list[i].visual; 55 graphic[0].visualclass = TRUE; 56 goto test_pixels; 57 } 58 # endif 59 60 // attempt to select the most desirable type of visual: TrueColor (XXX is it still true?) 37 isColor = isDefault = FALSE; 38 39 // attempt to select the most desirable type of visual: TrueColor 61 40 for (i = 0; (i < Nfound) && (visual_list[i].class != TrueColor); i++); 62 41 if (i != Nfound) { … … 65 44 isDefault = (graphic[0].visual == visual_list[i].visual); 66 45 graphic[0].visual = visual_list[i].visual; 67 graphic[0].visualclass = FALSE; 46 graphic[0].dynamicColors = FALSE; 47 if (DEBUG) fprintf (stderr, "got TrueColor visual\n"); 48 goto test_pixels; 49 } 50 51 // attempt to select the most desirable type of visual: DirectColor 52 for (i = 0; (i < Nfound) && (visual_list[i].class != DirectColor); i++); 53 if (i != Nfound) { 54 isColor = TRUE; 55 if (DEBUG) fprintf (stderr, "visual class is %d\n", visual_list[i].class); 56 isDefault = (graphic[0].visual == visual_list[i].visual); 57 graphic[0].visual = visual_list[i].visual; 58 graphic[0].dynamicColors = TRUE; 59 if (DEBUG) fprintf (stderr, "got DirectColor visual\n"); 68 60 goto test_pixels; 69 61 } … … 72 64 for (i = 0; (i < Nfound) && (visual_list[i].class != PseudoColor); i++); 73 65 if (i != Nfound) { 74 isColor = isDynamic =TRUE;66 isColor = TRUE; 75 67 if (DEBUG) fprintf (stderr, "selected visual class is %d\n", visual_list[i].class); 76 68 isDefault = (graphic[0].visual == visual_list[i].visual); 77 69 graphic[0].visual = visual_list[i].visual; 78 graphic[0].visualclass = TRUE; 70 graphic[0].dynamicColors = TRUE; 71 if (DEBUG) fprintf (stderr, "got PseudoColor visual\n"); 79 72 goto test_pixels; 80 73 } … … 83 76 for (i = 0; (i < Nfound) && (visual_list[i].class != GrayScale); i++); 84 77 if (i != Nfound) { 85 isDynamic = TRUE;86 78 if (DEBUG) fprintf (stderr, "selected visual class is %d\n", visual_list[i].class); 87 79 isDefault = (graphic[0].visual == visual_list[i].visual); 88 80 graphic[0].visual = visual_list[i].visual; 89 graphic[0].visualclass = TRUE; 81 graphic[0].dynamicColors = TRUE; 82 if (DEBUG) fprintf (stderr, "got GrayScale visual\n"); 90 83 goto test_pixels; 91 84 } … … 97 90 isDefault = (graphic[0].visual == visual_list[i].visual); 98 91 graphic[0].visual = visual_list[i].visual; 99 graphic[0].visualclass = FALSE; 92 graphic[0].dynamicColors = FALSE; 93 if (DEBUG) fprintf (stderr, "got StaticColor visual\n"); 100 94 goto test_pixels; 101 95 } … … 107 101 isDefault = (graphic[0].visual == visual_list[i].visual); 108 102 graphic[0].visual = visual_list[i].visual; 109 graphic[0].visualclass = FALSE; 103 graphic[0].dynamicColors = FALSE; 104 if (DEBUG) fprintf (stderr, "got StaticGray visual\n"); 110 105 goto test_pixels; 111 106 } … … 115 110 /* need to make a colormap if 116 111 1) the selected visual is not the default 112 XXX not sure if I need to / am allowed to alloc a colormap if I've grabbed the default. 117 113 2) there are not enough colors available */ 118 114 … … 125 121 } 126 122 127 // allocate a private colormap, if needed 123 // dynamic visual classes can accept AllocAll and can use XAllocColorCells while AllocNone must use XAllocColor 124 // int allocMode = graphic[0].dynamicColors ? AllocAll : AllocNone; 125 int allocMode = AllocNone; 126 127 // allocate a private colormap, if desired or needed 128 128 if (!isDefault) { 129 129 if (DEBUG) fprintf (stderr, "allocated private colormap\n"); 130 graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone);131 } 132 133 if ( isDynamic) {130 graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, allocMode); 131 } 132 133 if (graphic[0].dynamicColors) { 134 134 Npixels = NPIXELS_DYNAMIC; 135 135 if ((N = get_argument (*argc, argv, "-ncolors"))) { … … 144 144 for (graphic[0].Npixels = Npixels; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) { 145 145 if (DEBUG) fprintf (stderr, "trying %d colors\n", (int) graphic[0].Npixels); 146 if (XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels)) {146 if (XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 0, graphic[0].pixels, graphic[0].Npixels)) { 147 147 break; 148 } 149 for (i = 0; i < graphic[0].Npixels; i++) { 150 graphic[0].cmap[i].pixel = graphic[0].pixels[i]; 148 151 } 149 152 } … … 152 155 if (graphic[0].Npixels < 16) { 153 156 if (!isDefault) { 157 // We've already tried to allocate a colormap above... 154 158 fprintf (stderr, "can't allocate enough cells in private colormap\n"); 155 159 exit (0); 156 160 } 157 161 if (DEBUG) fprintf (stderr, "can't allocate enough cells, using private colormap\n"); 158 graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone);162 graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, allocMode); 159 163 160 164 for (graphic[0].Npixels = NPIXELS_DYNAMIC; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) { … … 163 167 break; 164 168 } 165 } 166 169 for (i = 0; i < graphic[0].Npixels; i++) { 170 graphic[0].cmap[i].pixel = graphic[0].pixels[i]; 171 } 172 } 167 173 if ((N = get_argument (*argc, argv, "-colorcount"))) { 168 174 fprintf (stderr, "kapa can grab %d colors\n", graphic[0].Npixels); -
trunk/Ohana/src/kapa2/src/CursorOps.c
r16270 r25757 2 2 3 3 // input coordinates are relative to the picture bounding box 4 // XXX pre-calculate fexpand, Xc, Yc when expand is set? 4 5 void Picture_to_Image (double *x1, double *y1, double x2, double y2, Picture *picture) { 5 6 … … 14 15 15 16 // pixel coordinates in picture frame 16 dx = expand*(x2 - 0.5*picture[0].dx); 17 dy = expand*(y2 - 0.5*picture[0].dy); 17 dx = expand*(x2 - (int)(0.5*picture[0].dx)); 18 dy = expand*(y2 - (int)(0.5*picture[0].dy)); 19 20 // set the true center (image and screen pixel boundaries must be aligned) 21 // Xc = (int)(picture[0].Xc / expand) * expand; 22 // Yc = (int)(picture[0].Yc / expand) * expand; 18 23 19 24 // picture[0].X,Y is the image coordinate in the center of the picture 20 *x1 = picture[0].flipx ? picture[0].X - dx : picture[0].X+ dx;21 *y1 = picture[0].flipy ? picture[0].Y - dy : picture[0].Y+ dy;25 *x1 = picture[0].flipx ? picture[0].Xc - dx : picture[0].Xc + dx; 26 *y1 = picture[0].flipy ? picture[0].Yc - dy : picture[0].Yc + dy; 22 27 } 23 28 … … 46 51 } 47 52 53 // set the true center (image and screen pixel boundaries must be aligned) 54 // Xc = ((int)(picture[0].Xc * expand)) / expand; 55 // Yc = ((int)(picture[0].Yc * expand)) / expand; 56 48 57 // pixel coordinates in picture frame 49 dx = picture[0].flipx ? picture[0].X - x2 : x2 - picture[0].X;50 dy = picture[0].flipy ? picture[0].Y - y2 : y2 - picture[0].Y;58 dx = picture[0].flipx ? picture[0].Xc - x2 : x2 - picture[0].Xc; 59 dy = picture[0].flipy ? picture[0].Yc - y2 : y2 - picture[0].Yc; 51 60 52 *x1 = expand*dx + 0.5*picture[0].dx;53 *y1 = expand*dy + 0.5*picture[0].dy;61 *x1 = expand*dx + (int)(0.5*picture[0].dx); 62 *y1 = expand*dy + (int)(0.5*picture[0].dy); 54 63 } 55 64 … … 66 75 67 76 // input coordinates are relative to the picture bounding box 68 void Picture_Lower (int *i_start, int *j_start, Matrix *matrix, Picture *picture) {77 void Picture_Lower (int *i_start, int *j_start, int *I_start, int *J_start, Matrix *matrix, Picture *picture) { 69 78 70 79 double Ix, Iy, Sx, Sy; … … 72 81 // Ix, Iy are the image coordinates of the specified screen pixel 73 82 Picture_to_Image (&Ix, &Iy, 0.0, 0.0, picture); 74 75 // Ix, Iy are now limited to valid image coordinates76 Ix = MIN (MAX (Ix, 0), matrix[0].Naxis[0]);77 Iy = MIN (MAX (Iy, 0), matrix[0].Naxis[1]);78 83 79 84 // round up (down) to nearest pixel boundary … … 84 89 Iy = picture[0].flipy ? (int)(Iy) : (int)(Iy) + 1; 85 90 } 91 92 // Ix, Iy are now limited to valid image coordinates 93 Ix = MIN (MAX (Ix, 0), matrix[0].Naxis[0]); 94 Iy = MIN (MAX (Iy, 0), matrix[0].Naxis[1]); 95 96 // I_start, J_start are the first displayed image pixel 97 *I_start = Ix; 98 *J_start = Iy; 86 99 87 100 // Sx, Sy are the screen coordinates of the Ix,Iy pixel … … 94 107 95 108 // input coordinates are relative to the picture bounding box 96 void Picture_Upper (int *i_end, int *j_end, Matrix *matrix, Picture *picture) {109 void Picture_Upper (int *i_end, int *j_end, int i_start, int j_start, Matrix *matrix, Picture *picture) { 97 110 111 int nExtra; 98 112 double Ix, Iy, Sx, Sy; 99 113 … … 101 115 Picture_to_Image (&Ix, &Iy, picture[0].dx, picture[0].dy, picture); 102 116 117 // round down (up) to nearest pixel boundary 118 if (Ix > (int)(Ix)) { 119 Ix = picture[0].flipx ? (int)(Ix) + 1: (int)(Ix); 120 } 121 if (Iy > (int)(Iy)) { 122 Iy = picture[0].flipy ? (int)(Iy) + 1: (int)(Iy); 123 } 124 103 125 // Ix, Iy are now limited to valid image coordinates 104 126 Ix = MIN (MAX (Ix, 0), matrix[0].Naxis[0]); 105 127 Iy = MIN (MAX (Iy, 0), matrix[0].Naxis[1]); 106 128 107 // round down (up) to nearest pixel boundary 108 if (Ix > (int)(Ix)) { 109 Ix = picture[0].flipx ? (int)(Ix) + 1 : (int)(Ix); 110 } 111 if (Iy > (int)(Iy)) { 112 Iy = picture[0].flipy ? (int)(Iy) + 1: (int)(Iy); 113 } 129 // I_end, J_end are the last displayed image pixel 130 // *I_end = Ix; 131 // *J_end = Iy; 114 132 115 133 // Sx, Sy are the screen coordinates of the Ix,Iy pixel … … 119 137 *i_end = MIN (MAX (Sx, 0), picture[0].dx); 120 138 *j_end = MIN (MAX (Sy, 0), picture[0].dy); 139 140 // round off error can leave us with a small number of extra pixels here. 141 if (picture[0].expand > 1) { 142 nExtra = (*i_end - i_start) % picture[0].expand; 143 *i_end -= nExtra; 144 nExtra = (*j_end - j_start) % picture[0].expand; 145 *j_end -= nExtra; 146 } 121 147 } -
trunk/Ohana/src/kapa2/src/DragColorbar.c
r16011 r25757 10 10 int xstatus, Npix, center; 11 11 12 if (!graphic[0]. visualclass) return;12 if (!graphic[0].dynamicColors) return; 13 13 14 14 X = mouse_event[0].x; … … 79 79 XColor cmap[256]; 80 80 81 if (!graphic[0]. visualclass) return;81 if (!graphic[0].dynamicColors) return; 82 82 83 83 for (i = 0; i < graphic[0].Npixels; i++) { … … 88 88 cmap[i].blue = graphic[0].cmap[0].blue; 89 89 cmap[i].green = graphic[0].cmap[0].green; 90 cmap[i].flags = DoRed | DoGreen | DoBlue; 90 91 } 91 92 else { … … 94 95 cmap[i].blue = graphic[0].cmap[graphic[0].Npixels-1].blue; 95 96 cmap[i].green = graphic[0].cmap[graphic[0].Npixels-1].green; 97 cmap[i].flags = DoRed | DoGreen | DoBlue; 96 98 } 97 99 else { … … 99 101 cmap[i].blue = graphic[0].cmap[j].blue; 100 102 cmap[i].green = graphic[0].cmap[j].green; 103 cmap[i].flags = DoRed | DoGreen | DoBlue; 101 104 } 102 105 } -
trunk/Ohana/src/kapa2/src/Image.c
r21153 r25757 48 48 49 49 // set the center and expansion for the pictures: 50 image[0].picture.X = 0.0;51 image[0].picture.Y = 0.0;50 image[0].picture.Xc = 0.0; 51 image[0].picture.Yc = 0.0; 52 52 image[0].picture.expand = 1; 53 53 image[0].picture.flipx = FALSE; 54 54 image[0].picture.flipy = FALSE; 55 55 56 image[0].zoom.X = 0.0;57 image[0].zoom.Y = 0.0;58 image[0].zoom.expand = +5;56 image[0].zoom.Xc = 0.0; 57 image[0].zoom.Yc = 0.0; 58 image[0].zoom.expand = 5; 59 59 image[0].zoom.flipx = FALSE; 60 60 image[0].zoom.flipy = FALSE; 61 61 62 image[0].wide.X = 0.0;63 image[0].wide.Y = 0.0;62 image[0].wide.Xc = 0.0; 63 image[0].wide.Yc = 0.0; 64 64 image[0].wide.expand = -5; 65 65 image[0].wide.flipx = FALSE; … … 144 144 image[0].picture.dx+1, image[0].picture.dy+1); 145 145 146 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 147 image[0].picture.pix, 0, 0, 148 image[0].picture.x + 1, image[0].picture.y + 1, 149 image[0].picture.dx, image[0].picture.dy); 146 if (image[0].picture.pix) { 147 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 148 image[0].picture.pix, 0, 0, 149 image[0].picture.x + 1, image[0].picture.y + 1, 150 image[0].picture.dx, image[0].picture.dy); 151 } 150 152 151 153 for (i = 0; i < NOVERLAYS; i++) { … … 156 158 157 159 if (image[0].location) { 158 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 159 image[0].cmapbar.pix, 0, 0, 160 image[0].cmapbar.x, image[0].cmapbar.y, 161 image[0].cmapbar.dx, image[0].cmapbar.dy); 162 163 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 164 image[0].wide.pix, 0, 0, 165 image[0].wide.x, image[0].wide.y, 166 image[0].wide.dx, image[0].wide.dy); 160 if (image[0].cmapbar.pix) { 161 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 162 image[0].cmapbar.pix, 0, 0, 163 image[0].cmapbar.x, image[0].cmapbar.y, 164 image[0].cmapbar.dx, image[0].cmapbar.dy); 165 } 166 if (image[0].wide.pix) { 167 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 168 image[0].wide.pix, 0, 0, 169 image[0].wide.x, image[0].wide.y, 170 image[0].wide.dx, image[0].wide.dy); 171 } 167 172 168 173 CrossHairs (graphic, &image[0].zoom); -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r18411 r25757 93 93 SetColorScale (graphic, image); 94 94 Remap (graphic, image); 95 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);95 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 96 96 break; 97 97 … … 100 100 SetColorScale (graphic, image); 101 101 Remap (graphic, image); 102 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);102 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 103 103 break; 104 104 … … 107 107 SetColorScale (graphic, image); 108 108 Remap (graphic, image); 109 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);109 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 110 110 break; 111 111 … … 113 113 case XK_Home: 114 114 image[0].picture.expand = 1; 115 Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0); 115 image[0].zoom.expand = 5; 116 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 116 117 break; 117 118 case XK_KP_End: 118 119 case XK_End: 119 120 image[0].picture.expand = 1; 121 image[0].zoom.expand = 5; 120 122 Reorient (graphic, image, 0.5*image[0].image[0].matrix.Naxis[0], 0.5*image[0].image[0].matrix.Naxis[1], 0); 121 123 break; … … 128 130 case XK_Prior: 129 131 case XK_KP_Prior: 130 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, +1);132 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, +1); 131 133 break; 132 134 case XK_Next: 133 135 case XK_KP_Next: 134 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, -1);136 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, -1); 135 137 break; 136 138 case XK_Up: 137 139 case XK_KP_Up: 138 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y+ offset, 0);140 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc + offset, 0); 139 141 break; 140 142 case XK_Down: 141 143 case XK_KP_Down: 142 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y- offset, 0);144 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc - offset, 0); 143 145 break; 144 146 case XK_Left: 145 147 case XK_KP_Left: 146 Reorient (graphic, image, image[0].picture.X + offset, image[0].picture.Y, 0);148 Reorient (graphic, image, image[0].picture.Xc + offset, image[0].picture.Yc, 0); 147 149 break; 148 150 case XK_Right: 149 151 case XK_KP_Right: 150 Reorient (graphic, image, image[0].picture.X - offset, image[0].picture.Y, 0);152 Reorient (graphic, image, image[0].picture.Xc - offset, image[0].picture.Yc, 0); 151 153 break; 152 154 … … 160 162 SetColorScale (graphic, image); 161 163 Remap (graphic, image); 162 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);164 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 163 165 break; 164 166 case XK_KP_Subtract: … … 171 173 SetColorScale (graphic, image); 172 174 Remap (graphic, image); 173 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);175 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 174 176 break; 175 177 -
trunk/Ohana/src/kapa2/src/JPEGit24.c
r19833 r25757 22 22 int ii, i, j; 23 23 int i_start, i_end, j_start, j_end; 24 int I_start, J_start; 24 25 int dropback; /* this is a bit of a kludge... */ 25 26 int dx, dy, DX, DY, inDX, inDY; … … 95 96 DY = image[0].image[0].matrix.Naxis[1]; 96 97 97 // x, yare the closest lit screen pixel to 0,098 Picture_Lower (&i_start, &j_start, &image[0].image[0].matrix, &image[0].picture);99 100 // x, y are the closest lit screen pixel to dx, dy 101 Picture_Upper (&i_end, &j_end, &image[0].image[0].matrix, &image[0].picture);102 103 if (i_end < i_start) MY_SWAP_INT (i_start, i_end);104 if (j_end < j_start) MY_SWAP_INT (j_start, j_end); 105 106 // Ix,Iy are the first displayed image pixel107 Picture_to_Image (&Ix, &Iy, i_start, j_start, &image[0].picture); 108 Ix = MIN (MAX (0, Ix), DX - 1);109 Iy = MIN (MAX (0, Iy), DY - 1);98 // i_start, j_start are the closest lit screen pixel to 0,0 99 // I_start, J_start are the image pixel corresponding to i_start, j_start 100 Picture_Lower (&i_start, &j_start, &I_start, &J_start, &image[0].image[0].matrix, &image[0].picture); 101 102 // i_end, j_end are the closest lit screen pixel to dx, dy 103 // I_end, J_end are the image pixel corresponding to i_end, j_end 104 Picture_Upper (&i_end, &j_end, i_start, j_start, &image[0].image[0].matrix, &image[0].picture); 105 106 assert (i_start <= i_end); 107 assert (j_start <= j_end); 108 109 Ix = image[0].picture.flipx ? I_start - 1 : I_start; 110 Iy = image[0].picture.flipy ? J_start - 1 : J_start; 110 111 111 112 inDX = image[0].picture.flipx ? -1 : +1; -
trunk/Ohana/src/kapa2/src/LoadPicture.c
r21060 r25757 25 25 Yoffset = 0.0; 26 26 if (image[0].image[0].matrix.size) { 27 Xoffset = image[0].picture.X - 0.5*image[0].image[0].matrix.Naxis[0]; 28 Yoffset = image[0].picture.Y - 0.5*image[0].image[0].matrix.Naxis[1]; 27 // XXX enforce int center here? 28 Xoffset = image[0].picture.Xc - 0.5*image[0].image[0].matrix.Naxis[0]; 29 Yoffset = image[0].picture.Yc - 0.5*image[0].image[0].matrix.Naxis[1]; 29 30 } 30 31 … … 49 50 50 51 // reference point for image is the center pixel 51 image[0].picture.X = 0.5*header.Naxis[0] + Xoffset;52 image[0].picture.Y = 0.5*header.Naxis[1] + Yoffset;52 image[0].picture.Xc = 0.5*header.Naxis[0] + Xoffset; 53 image[0].picture.Yc = 0.5*header.Naxis[1] + Yoffset; 53 54 54 55 // choose expand for wide to guarantee we fit: … … 59 60 image[0].wide.expand = 1.0 / wx; 60 61 } 61 image[0].wide.X = 0.5*header.Naxis[0];62 image[0].wide.Y = 0.5*header.Naxis[1];62 image[0].wide.Xc = 0.5*header.Naxis[0]; 63 image[0].wide.Yc = 0.5*header.Naxis[1]; 63 64 64 65 fcntl (sock, F_SETFL, O_NONBLOCK); -
trunk/Ohana/src/kapa2/src/MakeColormap.c
r16011 r25757 2 2 3 3 static char default_cmap[] = "grayscale"; 4 // static char default_cmap[] = "heat"; 4 5 5 6 void MakeColormap (int argc, char **argv) { -
trunk/Ohana/src/kapa2/src/PSOverlay.c
r19835 r25757 80 80 double sn = sin(angle); 81 81 x0 = X + pX*dX*cs; 82 y0 = Y +pY*dX*sn;82 y0 = Y - pY*dX*sn; 83 83 // XXX dt should be based on the size of the ellipse... 84 84 // 0.10 -> 60 segments on the ellipse 85 85 # define DT 0.1 86 86 for (t = DT; t < 2*M_PI + DT; t+=DT) { 87 x1 = X + pX*dX*cos(t)*cs -pX*dY*sin(t)*sn;88 y1 = Y +pY*dX*cos(t)*sn + pY*dY*sin(t)*cs;87 x1 = X + pX*dX*cos(t)*cs + pX*dY*sin(t)*sn; 88 y1 = Y - pY*dX*cos(t)*sn + pY*dY*sin(t)*cs; 89 89 fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", x0 + extra, y0 + extra, x1 + extra, y1 + extra); 90 90 x0 = x1; -
trunk/Ohana/src/kapa2/src/PaintOverlay.c
r20936 r25757 9 9 10 10 XSetForeground (graphic[0].display, graphic[0].gc, image[0].overlay[N].color); 11 XSetLineAttributes (graphic->display, graphic->gc, 2, LineSolid, CapNotLast, JoinMiter);11 XSetLineAttributes (graphic->display, graphic->gc, 1, LineSolid, CapNotLast, JoinMiter); 12 12 13 13 expand = 1.0; … … 72 72 double sn = sin(angle); 73 73 x0 = X + pX*dx*cs; 74 y0 = Y -pY*dx*sn;74 y0 = Y + pY*dx*sn; 75 75 // XXX dt should be based on the size of the ellipse... 76 76 // 0.10 -> 60 segments on the ellipse 77 77 # define DT 0.1 78 78 for (t = DT; t < 2*M_PI + DT; t+=DT) { 79 x1 = X + pX*dx*cos(t)*cs +pX*dy*sin(t)*sn;80 y1 = Y -pY*dx*cos(t)*sn + pY*dy*sin(t)*cs;79 x1 = X + pX*dx*cos(t)*cs - pX*dy*sin(t)*sn; 80 y1 = Y + pY*dx*cos(t)*sn + pY*dy*sin(t)*cs; 81 81 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, x0, y0, x1, y1); 82 82 x0 = x1; -
trunk/Ohana/src/kapa2/src/Remap16.c
r18324 r25757 1 1 # include "Ximage.h" 2 # define OUT_TYPE unsigned short 2 3 3 4 # define MY_SWAP_BYTE(W) { \ … … 10 11 int i, j, ii, jj; 11 12 int i_start, i_end, j_start, j_end; 12 int dropback; 13 int I_start, J_start; 14 int dropback, inDX, inDY; 13 15 int dx, dy, DX, DY; 14 16 double expand, Ix, Iy; 15 17 int expand_in, expand_out; 16 unsigned short*out_pix, *out_pix2, *data;18 OUT_TYPE *out_pix, *out_pix2, *data; 17 19 unsigned short *in_pix, *in_pix2; 18 unsigned short*pixel, pixvalue;19 unsigned shortback;20 OUT_TYPE *pixel, pixvalue; 21 OUT_TYPE back; 20 22 int swap_client, swap_server, swap_bytes; 21 23 22 ALLOCATE (pixel, unsigned short, graphic[0].Npixels); 24 // just skip if there is no data 25 if (matrix[0].Naxes == 0) return; 26 if (matrix[0].Naxis[0] == 0) return; 27 if (matrix[0].Naxis[1] == 0) return; 28 29 ALLOCATE (pixel, OUT_TYPE, graphic[0].Npixels); 23 30 24 31 # ifdef BYTE_SWAP … … 38 45 back = 0xffff & graphic[0].back; 39 46 if (swap_bytes) MY_SWAP_BYTE (back); 40 // XXX not certain this is the correct solution...41 47 42 48 // set up expansions … … 60 66 DY = matrix[0].Naxis[1]; 61 67 62 // x, y are the closest lit screen pixel to 0,0 63 Picture_Lower (&i_start, &j_start, matrix, picture); 68 // i_start, j_start are the closest lit screen pixel to 0,0 69 // I_start, J_start are the image pixel corresponding to i_start, j_start 70 Picture_Lower (&i_start, &j_start, &I_start, &J_start, matrix, picture); 64 71 65 // x, y are the closest lit screen pixel to dx, dy 66 Picture_Upper (&i_end, &j_end, matrix, picture); 72 // i_end, j_end are the closest lit screen pixel to dx, dy 73 // I_end, J_end are the image pixel corresponding to i_end, j_end 74 Picture_Upper (&i_end, &j_end, i_start, j_start, matrix, picture); 67 75 68 // Ix,Iy are the first displayed image pixel 69 Picture_to_Image (&Ix, &Iy, i_start, j_start, picture); 76 assert (i_start <= i_end); 77 assert (j_start <= j_end); 78 79 Ix = picture[0].flipx ? I_start - 1 : I_start; 80 Iy = picture[0].flipy ? J_start - 1 : J_start; 81 82 inDX = picture[0].flipx ? -1 : +1; 83 inDY = picture[0].flipy ? -1 : +1; 70 84 71 85 dropback = expand_out - (i_end - i_start) % expand_out; 72 86 if ((i_end - i_start) % expand_out == 0) dropback = 0; 73 87 74 data = out_pix = (unsigned short*) picture[0].data;88 out_pix = data = (OUT_TYPE *) picture[0].data; 75 89 in_pix = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)]; 76 90 … … 82 96 } 83 97 84 for (j = j_start; j < j_end; j+= expand_out, in_pix += expand_in*DX) {98 for (j = j_start; j < j_end; j+= expand_out, in_pix += inDY*expand_in*DX) { 85 99 out_pix = &data[j*dx]; 86 100 … … 97 111 in_pix2 = in_pix; 98 112 if (expand_out == 1) { 99 for (i = i_start; i < i_end; i++, in_pix2 +=expand_in, out_pix++) {113 for (i = i_start; i < i_end; i++, in_pix2 += inDX*expand_in, out_pix++) { 100 114 *out_pix = pixel[*in_pix2]; 101 115 } 102 116 } else { 103 for (i = i_start; i < i_end; i+= expand_out, in_pix2 ++, out_pix+= expand_out) {117 for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= expand_out) { 104 118 pixvalue = pixel[*in_pix2]; 105 119 out_pix2 = out_pix; … … 124 138 /**** fill in top area ****/ 125 139 out_pix = &data[j_end*dx]; 126 for (j = 0; j < (dy - j_end); j++) {140 for (j = 0; j < dy - j_end; j++) { 127 141 for (i = 0; i < dx; i++, out_pix++) { 128 142 *out_pix = back; -
trunk/Ohana/src/kapa2/src/Remap24.c
r18324 r25757 5 5 int i, j, ii, jj; 6 6 int i_start, i_end, j_start, j_end; 7 int dropback, extra; 7 int I_start, J_start; 8 int dropback, extra, inDX, inDY; 8 9 int dx, dy, DX, DY; 9 10 double expand, Ix, Iy; … … 53 54 extra = 4 - (dx * 3) % 4; 54 55 55 // x, y are the closest lit screen pixel to 0,0 56 Picture_Lower (&i_start, &j_start, matrix, picture); 56 // i_start, j_start are the closest lit screen pixel to 0,0 57 // I_start, J_start are the image pixel corresponding to i_start, j_start 58 Picture_Lower (&i_start, &j_start, &I_start, &J_start, matrix, picture); 57 59 58 // x, y are the closest lit screen pixel to dx, dy 59 Picture_Upper (&i_end, &j_end, matrix, picture); 60 // i_end, j_end are the closest lit screen pixel to dx, dy 61 // I_end, J_end are the image pixel corresponding to i_end, j_end 62 Picture_Upper (&i_end, &j_end, i_start, j_start, matrix, picture); 60 63 61 // Ix,Iy are the first displayed image pixel 62 Picture_to_Image (&Ix, &Iy, i_start, j_start, picture); 64 assert (i_start <= i_end); 65 assert (j_start <= j_end); 66 67 Ix = picture[0].flipx ? I_start - 1 : I_start; 68 Iy = picture[0].flipy ? J_start - 1 : J_start; 69 70 inDX = picture[0].flipx ? -1 : +1; 71 inDY = picture[0].flipy ? -1 : +1; 63 72 64 73 dropback = expand_out - (i_end - i_start) % expand_out; … … 80 89 } 81 90 82 for (j = j_start; j < j_end; j+= expand_out, in_pix += expand_in*DX) {91 for (j = j_start; j < j_end; j+= expand_out, in_pix += inDY*expand_in*DX) { 83 92 out_pix = &data[j*(3*dx+extra)]; 84 93 … … 97 106 in_pix2 = in_pix; 98 107 if (expand_out == 1) { 99 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix+=3) {108 for (i = i_start; i < i_end; i++, in_pix2+= inDX*expand_in, out_pix+=3) { 100 109 out_pix[0] = pixel1[*in_pix2]; 101 110 out_pix[1] = pixel2[*in_pix2]; … … 103 112 } 104 113 } else { 105 for (i = i_start; i < i_end; i+= expand_out, in_pix2 ++, out_pix+= 3*expand_out) {114 for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= 3*expand_out) { 106 115 pixvalue1 = pixel1[*in_pix2]; 107 116 pixvalue2 = pixel2[*in_pix2]; … … 121 130 /**** fill in area to the right of the picture ****/ 122 131 for (jj = 0; (jj < expand_out) && (j + jj < dy); jj++) { 123 // for (jj = 0; jj < expand_out; jj++) {124 132 out_pix2 = out_pix + jj*(3*dx+extra); 125 133 for (i = i_end; i < dx; i++, out_pix2+=3) { -
trunk/Ohana/src/kapa2/src/Remap32.c
r18324 r25757 1 1 # include "Ximage.h" 2 # define OUT_TYPE unsigned int 2 3 3 4 # define MY_SWAP_INT(A,B) { int tmp; tmp = A; A = B; B = tmp; } 4 5 5 # define MY_SWAP_WORD(W) { \6 char tmp, *X;\7 X = (char *) &W;\8 tmp = X[0]; X[0] = X[3]; X[3] = tmp;\9 tmp = X[1]; X[1] = X[2]; X[2] = tmp; }6 # define MY_SWAP_WORD(W) { \ 7 char tmp, *X; \ 8 X = (char *) &W; \ 9 tmp = X[0]; X[0] = X[3]; X[3] = tmp; \ 10 tmp = X[1]; X[1] = X[2]; X[2] = tmp; } 10 11 11 12 void Remap32 (Graphic *graphic, KapaImageWidget *image, Picture *picture, Matrix *matrix) { … … 13 14 int i, j, ii, jj; 14 15 int i_start, i_end, j_start, j_end; 16 int I_start, J_start; 15 17 int dropback, inDX, inDY; 16 18 int dx, dy, DX, DY; 17 19 double expand, Ix, Iy; 18 20 int expand_in, expand_out; 19 unsigned int *out_pix, *out_pix2;21 OUT_TYPE *out_pix, *out_pix2, *data; 20 22 unsigned short *in_pix, *in_pix2; 21 unsigned long*pixel, pixvalue;22 unsigned longback;23 OUT_TYPE *pixel, pixvalue; 24 OUT_TYPE back; 23 25 int swap_client, swap_server, swap_bytes; 24 26 25 ALLOCATE (pixel, unsigned long, graphic[0].Npixels); 27 // just skip if there is no data 28 if (matrix[0].Naxes == 0) return; 29 if (matrix[0].Naxis[0] == 0) return; 30 if (matrix[0].Naxis[1] == 0) return; 31 32 ALLOCATE (pixel, OUT_TYPE, graphic[0].Npixels); 26 33 27 34 # ifdef BYTE_SWAP … … 43 50 44 51 // set up expansions 45 assert ((picture[0].expand >= 1) || (picture[0].expand <= - 1));52 assert ((picture[0].expand >= 1) || (picture[0].expand <= -2)); 46 53 expand = expand_in = expand_out = 1.0; 47 54 if (picture[0].expand > 0) { … … 62 69 DY = matrix[0].Naxis[1]; 63 70 64 // x, y are the closest lit screen pixel to 0,0 65 Picture_Lower (&i_start, &j_start, matrix, picture); 71 // i_start, j_start are the closest lit screen pixel to 0,0 72 // I_start, J_start are the image pixel corresponding to i_start, j_start 73 Picture_Lower (&i_start, &j_start, &I_start, &J_start, matrix, picture); 66 74 67 // x, y are the closest lit screen pixel to dx, dy 68 Picture_Upper (&i_end, &j_end, matrix, picture); 75 // i_end, j_end are the closest lit screen pixel to dx, dy 76 // I_end, J_end are the image pixel corresponding to i_end, j_end 77 Picture_Upper (&i_end, &j_end, i_start, j_start, matrix, picture); 69 78 70 if (i_end < i_start) MY_SWAP_INT (i_start,i_end);71 if (j_end < j_start) MY_SWAP_INT (j_start,j_end);79 assert (i_start <= i_end); 80 assert (j_start <= j_end); 72 81 73 // Ix,Iy are the first displayed image pixel 74 Picture_to_Image (&Ix, &Iy, i_start, j_start, picture); 75 Ix = MIN (MAX (0, Ix), DX - 1); 76 Iy = MIN (MAX (0, Iy), DY - 1); 77 // XXX not completely consistent with the i_start, i_end range... 78 79 // we need to offset because i_start points to the bottom edge of Ix 80 // if (picture[0].flipx) Ix -= 1.0; 81 // if (picture[0].flipy) Iy -= 1.0; 82 Ix = picture[0].flipx ? I_start - 1 : I_start; 83 Iy = picture[0].flipy ? J_start - 1 : J_start; 82 84 83 85 inDX = picture[0].flipx ? -1 : +1; … … 87 89 if ((i_end - i_start) % expand_out == 0) dropback = 0; 88 90 89 out_pix = (unsigned int*) picture[0].data;91 out_pix = data = (OUT_TYPE *) picture[0].data; 90 92 in_pix = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)]; 91 93 … … 97 99 } 98 100 99 for (j = j_start; j < j_end; j+= expand_out, out_pix+=(expand_out-1)*dx, in_pix += inDY*expand_in*DX) { 101 for (j = j_start; j < j_end; j+= expand_out, in_pix += inDY*expand_in*DX) { 102 out_pix = &data[j*dx]; 100 103 101 104 /**** fill in area to the left of the picture ****/ … … 126 129 } 127 130 out_pix -= dropback; 128 129 // assert (in_pix2 - image[0].pixmap <= DX*DY);130 // assert (in_pix2 - image[0].pixmap >= 0);131 // assert (in_pix - image[0].pixmap <= DX*DY);132 // assert (in_pix - image[0].pixmap >= 0);133 131 134 132 /**** fill in area to the right of the picture ****/ … … 139 137 } 140 138 } 141 out_pix += (dx - i_end);142 // assert (out_pix - (unsigned int *)picture[0].data <= dx*dy);143 // assert (out_pix - (unsigned int *)picture[0].data >= 0);144 139 } 145 146 if ((j_end - j_start) % expand_out > 0)147 out_pix -= expand_out - (j_end - j_start) % expand_out;148 149 // assert (out_pix - (unsigned int *)picture[0].data <= dx*dy);150 // assert (out_pix - (unsigned int *)picture[0].data >= 0);151 140 152 141 /**** fill in top area ****/ 153 for (j = 0; (j < dx*(dy - j_end)) && (out_pix - (unsigned int *)picture[0].data < dx*dy); j++, out_pix++) { 154 *out_pix = back; 142 out_pix = &data[j_end*dx]; 143 for (j = 0; j < dy - j_end; j++) { 144 for (i = 0; i < dx; i++, out_pix ++) { 145 *out_pix = back; 146 } 155 147 } 156 148 157 149 picture[0].pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0, 158 picture[0].data, picture[0].dx, picture[0].dy, 32, 0);150 picture[0].data, picture[0].dx, picture[0].dy, 32, 0); 159 151 160 152 free (pixel); -
trunk/Ohana/src/kapa2/src/Remap8.c
r18324 r25757 1 1 # include "Ximage.h" 2 # define OUT_TYPE unsigned char 2 3 3 4 void Remap8 (Graphic *graphic, KapaImageWidget *image, Picture *picture, Matrix *matrix) { … … 5 6 int i, j, ii, jj; 6 7 int i_start, i_end, j_start, j_end; 7 int dropback; 8 int I_start, J_start; 9 int dropback, inDX, inDY; 8 10 int dx, dy, DX, DY; 9 11 double expand, Ix, Iy; 10 12 int expand_in, expand_out; 11 unsigned char *out_pix, *out_pix2;12 unsigned short *in_pix, *in_pix2;13 unsigned char*pixel, pixvalue;14 unsigned charback;13 OUT_TYPE *out_pix, *out_pix2, *data; 14 unsigned short *in_pix, *in_pix2; 15 OUT_TYPE *pixel, pixvalue; 16 OUT_TYPE back; 15 17 16 ALLOCATE (pixel, unsigned char, graphic[0].Npixels); 18 // just skip if there is no data 19 if (matrix[0].Naxes == 0) return; 20 if (matrix[0].Naxis[0] == 0) return; 21 if (matrix[0].Naxis[1] == 0) return; 22 23 ALLOCATE (pixel, OUT_TYPE, graphic[0].Npixels); 17 24 18 25 // local array for pixel values … … 44 51 DY = matrix[0].Naxis[1]; 45 52 46 // x, y are the closest lit screen pixel to 0,0 47 Picture_Lower (&i_start, &j_start, matrix, picture); 53 // i_start, j_start are the closest lit screen pixel to 0,0 54 // I_start, J_start are the image pixel corresponding to i_start, j_start 55 Picture_Lower (&i_start, &j_start, &I_start, &J_start, matrix, picture); 48 56 49 // x, y are the closest lit screen pixel to dx, dy 50 Picture_Upper (&i_end, &j_end, matrix, picture); 57 // i_end, j_end are the closest lit screen pixel to dx, dy 58 // I_end, J_end are the image pixel corresponding to i_end, j_end 59 Picture_Upper (&i_end, &j_end, i_start, j_start, matrix, picture); 51 60 52 // Ix,Iy are the first displayed image pixel 53 Picture_to_Image (&Ix, &Iy, i_start, j_start, picture); 61 assert (i_start <= i_end); 62 assert (j_start <= j_end); 63 64 Ix = picture[0].flipx ? I_start - 1 : I_start; 65 Iy = picture[0].flipy ? J_start - 1 : J_start; 66 67 inDX = picture[0].flipx ? -1 : +1; 68 inDY = picture[0].flipy ? -1 : +1; 54 69 55 70 dropback = expand_out - (i_end - i_start) % expand_out; 56 71 if ((i_end - i_start) % expand_out == 0) dropback = 0; 57 72 58 out_pix = (unsigned char*) picture[0].data;73 out_pix = data = (OUT_TYPE *) picture[0].data; 59 74 in_pix = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)]; 60 75 … … 66 81 } 67 82 68 for (j = j_start; j < j_end; j+= expand_out, out_pix+=(expand_out-1)*dx, in_pix += expand_in*DX) { 83 for (j = j_start; j < j_end; j+= expand_out, in_pix += inDY*expand_in*DX) { 84 out_pix = &data[j*dx]; 69 85 70 86 /**** fill in area to the left of the picture ****/ … … 80 96 in_pix2 = in_pix; 81 97 if (expand_out == 1) { 82 for (i = i_start; i < i_end; i++, in_pix2 +=expand_in, out_pix++) {98 for (i = i_start; i < i_end; i++, in_pix2 += inDX*expand_in, out_pix++) { 83 99 *out_pix = pixel[*in_pix2]; 84 100 } 85 101 } else { 86 for (i = i_start; i < i_end; i+= expand_out, in_pix2 ++, out_pix+= expand_out) {102 for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= expand_out) { 87 103 pixvalue = pixel[*in_pix2]; 88 104 out_pix2 = out_pix; 89 for (jj = 0; (jj < expand_out) & (j + jj < dy); jj++, out_pix2+=(dx-expand_out)) {105 for (jj = 0; (jj < expand_out) && (j + jj < dy); jj++, out_pix2+=(dx-expand_out)) { 90 106 for (ii = 0; ii < expand_out; ii++, out_pix2++) { 91 107 *out_pix2 = pixvalue; … … 103 119 } 104 120 } 105 out_pix += (dx - i_end);106 107 121 } 108 122 109 if ((j_end - j_start) % expand_out > 0)110 out_pix -= expand_out - (j_end - j_start) % expand_out;111 112 123 /**** fill in top area ****/ 113 for (j = 0; (j < dx*(dy - j_end)) && (out_pix - (unsigned char *)picture[0].data < dx*dy); j++, out_pix++) { 114 *out_pix = back; 124 out_pix = &data[j_end*dx]; 125 for (j = 0; j < dy - j_end; j++) { 126 for (i = 0; i < dx; i++, out_pix++) { 127 *out_pix = back; 128 } 115 129 } 116 130 picture[0].pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0, -
trunk/Ohana/src/kapa2/src/Reorient.c
r16228 r25757 7 7 picture = &image[0].picture; 8 8 9 if (picture[0].expand == 0) picture[0].expand = 1; 9 if (picture[0].expand == 0) { 10 picture[0].expand = 1; 11 image[0].zoom.expand = 5; 12 } 10 13 11 if ((picture[0].X == X) && (picture[0].Y== Y) && (mode == 0)) {14 if ((picture[0].Xc == X) && (picture[0].Yc == Y) && (mode == 0)) { 12 15 Refresh (); 13 16 XFlush (graphic[0].display); … … 17 20 switch (mode) { 18 21 case 0: 19 if ((picture[0].X != X) || (picture[0].Y!= Y)) {20 picture[0].X = X;21 picture[0].Y = Y;22 if ((picture[0].Xc != X) || (picture[0].Yc != Y)) { 23 picture[0].Xc = X; 24 picture[0].Yc = Y; 22 25 } 23 26 break; … … 25 28 picture[0].expand--; 26 29 if ((picture[0].expand == 0) || (picture[0].expand == -1)) picture[0].expand = -2; 27 picture[0].X = X;28 picture[0].Y = Y;30 picture[0].Xc = X; 31 picture[0].Yc = Y; 29 32 break; 30 33 case +1: 31 34 picture[0].expand++; 32 35 if ((picture[0].expand == 0) || (picture[0].expand == -1)) picture[0].expand = 1; 33 picture[0].X = X;34 picture[0].Y = Y;36 picture[0].Xc = X; 37 picture[0].Yc = Y; 35 38 break; 36 39 } 40 image[0].zoom.expand = MIN(image[0].zoom.dx / 5.5, MAX(5, 2*picture[0].expand)); 37 41 38 42 Remap (graphic, image); -
trunk/Ohana/src/kapa2/src/SetColorScale.c
r16061 r25757 218 218 // store the colors 219 219 if (USE_XWINDOW) { 220 if (graphic[0]. visualclass) {220 if (graphic[0].dynamicColors) { 221 221 XStoreColors(graphic[0].display, graphic[0].colormap, graphic[0].cmap, Npixels); 222 222 } else { -
trunk/Ohana/src/kapa2/src/SetColormap.c
r16039 r25757 146 146 store_colors: 147 147 if (!USE_XWINDOW) return (TRUE); 148 if (graphic[0].visualclass) { 149 XStoreColors(graphic[0].display, graphic[0].colormap, graphic[0].cmap, graphic[0].Npixels); 148 if (graphic[0].dynamicColors) { 149 if (!XStoreColors(graphic[0].display, graphic[0].colormap, graphic[0].cmap, graphic[0].Npixels)) { 150 fprintf (stderr, "error storing colors\n"); 151 } 150 152 } else { 151 153 for (i = 0; i < graphic[0].Npixels; i++) { 152 if ( XAllocColor (graphic[0].display, graphic[0].colormap, &graphic[0].cmap[i]) == 0) {154 if (!XAllocColor (graphic[0].display, graphic[0].colormap, &graphic[0].cmap[i])) { 153 155 fprintf (stderr, "error on %d\n", i); 154 156 } -
trunk/Ohana/src/kapa2/src/SetUpGraphic.c
r21153 r25757 60 60 graphic->color = KapaX11colors (graphic->display, graphic->colormap, graphic->fore, &Ncolors); 61 61 if (MAP_WINDOW) MapWindow (graphic); 62 62 63 return; 63 64 } -
trunk/Ohana/src/kapa2/src/StatusBox.c
r16256 r25757 11 11 y = 0.5*image[0].image[0].matrix.Naxis[1]; 12 12 // z = -1; 13 image[0].zoom.X = x;14 image[0].zoom.Y = y;13 image[0].zoom.Xc = x; 14 image[0].zoom.Yc = y; 15 15 // image[0].z = z; 16 16 } else { 17 x = image[0].zoom.X ;18 y = image[0].zoom.Y ;17 x = image[0].zoom.Xc; 18 y = image[0].zoom.Yc; 19 19 // z = image[0].z; 20 20 } -
trunk/Ohana/src/kapa2/src/UpdatePointer.c
r16256 r25757 29 29 30 30 skip: 31 image[0].zoom.X = x;32 image[0].zoom.Y = y;31 image[0].zoom.Xc = x; 32 image[0].zoom.Yc = y; 33 33 34 34 UpdateStatusBox (graphic, image, x, y, z, 0); … … 36 36 37 37 CreateZoom (graphic, image); 38 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 39 image[0].zoom.pix, 0, 0, 40 image[0].zoom.x, image[0].zoom.y, 41 image[0].zoom.dx, image[0].zoom.dy); 38 if (image[0].zoom.pix) { 39 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 40 image[0].zoom.pix, 0, 0, 41 image[0].zoom.x, image[0].zoom.y, 42 image[0].zoom.dx, image[0].zoom.dy); 43 } 42 44 CrossHairs (graphic, &image[0].zoom); 43 45 XFlush (graphic[0].display); -
trunk/Ohana/src/kapa2/src/UpdateStatusBox.c
r16255 r25757 48 48 49 49 bzero (line, 100); 50 sprintf (line, "%10. 1f %10.1f", x, y);50 sprintf (line, "%10.2f %10.2f", x, y); 51 51 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 52 52 image[0].text_x + PAD1, image[0].text_y + 2*textpad + 2*PAD1, line, strlen(line)); -
trunk/Ohana/src/kapa2/src/bDrawOverlay.c
r19838 r25757 81 81 double sn = sin(angle); 82 82 x0 = X + pX*dx*cs; 83 y0 = Y -pY*dx*sn;83 y0 = Y + pY*dx*sn; 84 84 // XXX dt should be based on the size of the ellipse... 85 85 // 0.10 -> 60 segments on the ellipse 86 86 # define DT 0.1 87 87 for (t = DT; t < 2*M_PI + DT; t+=DT) { 88 x1 = X + pX*dx*cos(t)*cs +pX*dy*sin(t)*sn;89 y1 = Y -pY*dx*cos(t)*sn + pY*dy*sin(t)*cs;88 x1 = X + pX*dx*cos(t)*cs - pX*dy*sin(t)*sn; 89 y1 = Y + pY*dx*cos(t)*sn + pY*dy*sin(t)*cs; 90 90 bDrawLine (x0, y0, x1, y1); 91 91 x0 = x1; -
trunk/Ohana/src/libdvo/include/dvo.h
r24976 r25757 325 325 PhotCodeData *GetPhotcodeTable (void); 326 326 327 int LoadPhotcodes (char *catdir_file, char *master_file );327 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite); 328 328 int LoadPhotcodesText (char *filename); 329 329 int LoadPhotcodesFITS (char *filename); … … 432 432 SkyTable *SkyTableLoad PROTO((char *filename, int VERBOSE)); 433 433 SkyTable *SkyTableFromGSC PROTO((char *filename, int depth, int VERBOSE)); 434 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int depth, int VERBOSE));434 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE)); 435 435 int SkyTableSetDepth PROTO((SkyTable *sky, int depth)); 436 436 SkyList *SkyRegionByPoint PROTO((SkyTable *table, int depth, double ra, double dec)); -
trunk/Ohana/src/libdvo/src/LoadPhotcodes.c
r12332 r25757 1 1 # include <dvo.h> 2 2 3 int LoadPhotcodes (char *catdir_file, char *master_file ) {3 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite) { 4 4 5 5 /* first try to load the photcodes from the specified CATDIR location */ 6 6 if (LoadPhotcodesFITS (catdir_file)) return TRUE; 7 7 8 if (!readwrite) { 9 fprintf (stderr, "db is missing a photcode table & access is read-only -- create one with photcode-table -import\n"); 10 return FALSE; 11 } 12 8 13 /* next try to load the photcodes from the master text photcode file */ 9 14 /* automatically (or on demand?) save the text file to the FITS version */ 10 15 if (LoadPhotcodesText (master_file)) { 11 if (!check_file_access (catdir_file, TRUE, TRUE)) return TRUE;12 SavePhotcodesFITS (catdir_file);13 return TRUE;16 if (!check_file_access (catdir_file, TRUE, TRUE, TRUE)) return TRUE; 17 SavePhotcodesFITS (catdir_file); 18 return TRUE; 14 19 } 15 20 -
trunk/Ohana/src/libdvo/src/coordops.c
r19823 r25757 163 163 return (FALSE); 164 164 } 165 if (fabs(alpha) >= 180.0) return (FALSE); 165 166 *ra = alpha + coords[0].crval1; 166 167 *dec = delta + coords[0].crval2; -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r24748 r25757 180 180 181 181 int Nsecfilt, mode; 182 int BACKUP, READWRITE; 182 183 183 184 mode = DVO_OPEN_NONE; … … 192 193 dvo_catalog_init (catalog, FALSE); 193 194 195 // default access control options: 194 196 catalog[0].lockmode = LCK_XCLD; 195 if (mode == DVO_OPEN_READ) catalog[0].lockmode = LCK_SOFT; 197 BACKUP = TRUE; 198 READWRITE = TRUE; 199 200 // in read-only mode, do not backup or require write access 201 if (mode == DVO_OPEN_READ) { 202 catalog[0].lockmode = LCK_SOFT; 203 BACKUP = FALSE; 204 READWRITE = FALSE; 205 } 196 206 197 // XXX make a backup? always? 198 if (!check_file_access (catalog[0].filename, TRUE, VERBOSE)) { 207 if (!check_file_access (catalog[0].filename, BACKUP, READWRITE, VERBOSE)) { 199 208 if (VERBOSE) fprintf (stderr, "no permission to access %s\n", catalog[0].filename); 200 209 return (FALSE); -
trunk/Ohana/src/libdvo/src/dvo_image.c
r24748 r25757 4 4 int dvo_image_lock (FITS_DB *db, char *filename, double timeout, int lockstate) { 5 5 6 /* lock the image catalog */ 7 if (!check_file_access (filename, FALSE, TRUE)) return (FALSE); 6 int READWRITE; 7 8 // default access control options: 9 READWRITE = TRUE; 10 11 // in read-only mode, do not backup or require write access 12 if (lockstate == LCK_SOFT) { 13 READWRITE = FALSE; 14 } 15 16 // do not perform a backup here 17 if (!check_file_access (filename, FALSE, READWRITE, TRUE)) return (FALSE); 8 18 9 19 db[0].lockstate = lockstate; -
trunk/Ohana/src/libdvo/src/skyregion_io.c
r17000 r25757 84 84 } 85 85 86 SkyTable *SkyTableLoadOptimal (char *catdir, char *skyfile, char *gscfile, int depth, int verbose) {86 SkyTable *SkyTableLoadOptimal (char *catdir, char *skyfile, char *gscfile, int readwrite, int depth, int verbose) { 87 87 88 88 char filename[256]; … … 93 93 sprintf (filename, "%s/SkyTable.fits", catdir); 94 94 if (stat (filename, &filestat)) goto SKYFILE; 95 if (!check_file_access (filename, FALSE, verbose)) goto SKYFILE;95 if (!check_file_access (filename, FALSE, readwrite, verbose)) goto SKYFILE; 96 96 sky = SkyTableLoad (filename, verbose); 97 97 if (sky == NULL) { … … 106 106 if (skyfile[0] != 0) goto GSCFILE; 107 107 if (stat (skyfile, &filestat)) goto GSCFILE; 108 if (!check_file_access (skyfile, FALSE, verbose)) goto GSCFILE;108 if (!check_file_access (skyfile, FALSE, readwrite, verbose)) goto GSCFILE; 109 109 sky = SkyTableLoad (skyfile, verbose); 110 110 if (sky == NULL) { … … 117 117 /* create CATDIR copy */ 118 118 sprintf (filename, "%s/SkyTable.fits", catdir); 119 check_file_access (filename, FALSE, verbose);119 check_file_access (filename, FALSE, readwrite, verbose); 120 120 if (!SkyTableSave (sky, filename)) return NULL; 121 121 … … 134 134 /* create CATDIR copy */ 135 135 sprintf (filename, "%s/SkyTable.fits", catdir); 136 check_file_access (filename, FALSE, verbose);136 check_file_access (filename, FALSE, readwrite, verbose); 137 137 if (!SkyTableSave (sky, filename)) return NULL; 138 138 -
trunk/Ohana/src/libkapa/include/kapa.h
r21153 r25757 154 154 /* KapaWindow.c */ 155 155 int KiiResize (int fd, int Nx, int Ny); 156 int KiiRelocate (int fd, int x, int y); 156 157 int KiiCenter (int fd, double x, double y, int zoom); 157 158 int KiiParity (int fd, int xflip, int yflip); -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r21060 r25757 23 23 KiiSendCommand (fd, 4, "RSIZ"); 24 24 KiiSendMessage (fd, "%d %d", Nx, Ny); 25 KiiWaitAnswer (fd, "DONE"); 26 return (TRUE); 27 } 28 29 int KiiRelocate (int fd, int x, int y) { 30 31 KiiSendCommand (fd, 4, "MOVE"); 32 KiiSendMessage (fd, "%d %d", x, y); 25 33 KiiWaitAnswer (fd, "DONE"); 26 34 return (TRUE); -
trunk/Ohana/src/libohana/include/ohana.h
r21508 r25757 166 166 int mkdirhier PROTO((char *path, int mode)); 167 167 void make_backup PROTO((char *filename)); 168 int check_file_access PROTO((char *basefile, int backup, int verbose));168 int check_file_access PROTO((char *basefile, int backup, int readwrite, int verbose)); 169 169 int check_dir_access PROTO((char *path, int verbose)); 170 170 int check_file_exec PROTO((char *filename)); -
trunk/Ohana/src/libohana/src/findexec.c
r18051 r25757 67 67 - file backup permission OK (optional) 68 68 */ 69 int check_file_access (char *basefile, int BACKUP, int VERBOSE) {69 int check_file_access (char *basefile, int BACKUP, int READWRITE, int VERBOSE) { 70 70 71 71 char *path, *filename; … … 74 74 gid_t gid; 75 75 int status; 76 int valid; 76 77 77 78 uid = getuid(); 78 79 gid = getgid(); 80 81 // XXX this function needs to call 'getgroups' to get the full list of the user's 82 // groups. we would then need to loop over all groups in the gid test below 83 // to see if any match the file. test to see how slow this is. 79 84 80 85 /* check permission to write to directory */ … … 87 92 status = stat (basefile, &filestat); 88 93 if (status == 0) { /* file exists, are permissions OK? */ 89 if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRUSR) && (filestat.st_mode & S_IWUSR)) || 90 ((gid == filestat.st_gid) && (filestat.st_mode & S_IRGRP) && (filestat.st_mode & S_IWGRP)) || 91 ((filestat.st_mode & S_IROTH) && (filestat.st_mode & S_IWOTH))) { 92 } else { 94 valid = FALSE; 95 if (!valid && (uid == filestat.st_uid)) { 96 valid = (filestat.st_mode & S_IRUSR) != 0; 97 valid &= !READWRITE || (filestat.st_mode & S_IWUSR); 98 } 99 if (!valid && (gid == filestat.st_gid)) { 100 valid = (filestat.st_mode & S_IRGRP) != 0; 101 valid &= !READWRITE || (filestat.st_mode & S_IWGRP); 102 } 103 if (!valid) { 104 valid = (filestat.st_mode & S_IROTH) != 0; 105 valid &= !READWRITE || (filestat.st_mode & S_IWOTH); 106 } 107 if (!valid) { 93 108 if (VERBOSE) fprintf (stderr, "can't write to %s\n", basefile); 94 109 return (FALSE); … … 102 117 status = stat (filename, &filestat); 103 118 if (status == 0) { /* file exists, are permissions OK? */ 104 if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRUSR) && (filestat.st_mode & S_IWUSR)) || 105 ((gid == filestat.st_gid) && (filestat.st_mode & S_IRGRP) && (filestat.st_mode & S_IWGRP)) || 106 ((filestat.st_mode & S_IROTH) && (filestat.st_mode & S_IWOTH))) { 107 } else { 119 valid = FALSE; 120 if (!valid && (uid == filestat.st_uid)) { 121 valid = (filestat.st_mode & S_IRUSR) != 0; 122 valid &= !READWRITE || (filestat.st_mode & S_IWUSR); 123 } 124 if (!valid && (gid == filestat.st_gid)) { 125 valid = (filestat.st_mode & S_IRGRP) != 0; 126 valid &= !READWRITE || (filestat.st_mode & S_IWGRP); 127 } 128 if (!valid) { 129 valid = (filestat.st_mode & S_IROTH) != 0; 130 valid &= !READWRITE || (filestat.st_mode & S_IWOTH); 131 } 132 if (!valid) { 108 133 if (VERBOSE) fprintf (stderr, "can't write to %s\n", filename); 109 134 return (FALSE); -
trunk/Ohana/src/markrock/src/ConfigInit.c
r12332 r25757 44 44 /* XXX this does not yet write out the master photcode table */ 45 45 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 46 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {46 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 47 47 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 48 48 exit (1); -
trunk/Ohana/src/markrock/src/markrock.c
r15743 r25757 33 33 34 34 /* if lockfile exists, program will complain and quit */ 35 if (!check_file_access (argv[1], TRUE, TRUE )) exit (1);36 if (!check_file_access (RockCat, TRUE, TRUE )) exit (1);35 if (!check_file_access (argv[1], TRUE, TRUE, TRUE)) exit (1); 36 if (!check_file_access (RockCat, TRUE, TRUE, TRUE)) exit (1); 37 37 38 38 catalog.filename = argv[1]; -
trunk/Ohana/src/markstar/src/ConfigInit.c
r12332 r25757 54 54 /* XXX this does not yet write out the master photcode table */ 55 55 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 56 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {56 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 57 57 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 58 58 exit (1); -
trunk/Ohana/src/mosastro/src/getptolemy.c
r16810 r25757 19 19 20 20 /* load regions from GSC table, restrict to patch */ 21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, FALSE, SKY_DEPTH_HST, VERBOSE); 22 22 SkyTableSetFilenames (sky, CATDIR, "cpt"); 23 23 skylist = SkyListByPatch (sky, -1, &patch); -
trunk/Ohana/src/opihi/cmd.astro/Makefile
r21061 r25757 21 21 $(SRC)/cgrid.$(ARCH).o \ 22 22 $(SRC)/coords.$(ARCH).o \ 23 $(SRC)/cdot.$(ARCH).o \ 23 24 $(SRC)/cplot.$(ARCH).o \ 24 25 $(SRC)/csystem.$(ARCH).o \ … … 36 37 $(SRC)/medianmap.$(ARCH).o \ 37 38 $(SRC)/mkgauss.$(ARCH).o \ 39 $(SRC)/mksersic.$(ARCH).o \ 40 $(SRC)/galradius.$(ARCH).o \ 41 $(SRC)/galradbins.$(ARCH).o \ 42 $(SRC)/galsectors.$(ARCH).o \ 43 $(SRC)/galprofiles.$(ARCH).o \ 44 $(SRC)/elliprofile.$(ARCH).o \ 45 $(SRC)/petrosian.$(ARCH).o \ 38 46 $(SRC)/multifit.$(ARCH).o \ 39 47 $(SRC)/objload.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r20936 r25757 37 37 /* set spacings for RA */ 38 38 minorRA = minorDEC = 0.1; 39 range = MIN (fabs(graphmode. xmax-graphmode.xmin), fabs(graphmode.ymax-graphmode.ymin));39 range = MIN (fabs(graphmode.coords.cdelt1*(graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin))); 40 40 if (NorthPole || SouthPole) range = 360; 41 41 lrange = log10(MAX(fabs(range), 1e-30)); … … 58 58 } 59 59 dR = range / 100.0; 60 60 61 /* set spacings for DEC */ 61 range = MIN (fabs(graphmode. xmax-graphmode.xmin), fabs(graphmode.ymax-graphmode.ymin));62 range = MIN (fabs(graphmode.coords.cdelt1*(graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin))); 62 63 lrange = log10(MAX(fabs(range), 1e-30)); 63 64 factor = (int) (lrange); -
trunk/Ohana/src/opihi/cmd.astro/init.c
r21061 r25757 5 5 int cgrid PROTO((int, char **)); 6 6 int coords PROTO((int, char **)); 7 int cdot PROTO((int, char **)); 7 8 int cplot PROTO((int, char **)); 8 9 int csystem PROTO((int, char **)); … … 22 23 int imsub PROTO((int, char **)); 23 24 int medianmap PROTO((int, char **)); 25 int galsectors PROTO((int, char **)); 26 int galprofiles PROTO((int, char **)); 27 int galradius PROTO((int, char **)); 28 int galradbins PROTO((int, char **)); 29 int elliprofile PROTO((int, char **)); 30 int petrosian PROTO((int, char **)); 24 31 int mkgauss PROTO((int, char **)); 32 int mksersic PROTO((int, char **)); 25 33 int multifit PROTO((int, char **)); 26 34 int objload PROTO((int, char **)); … … 44 52 {1, "cgrid", cgrid, "plot sky coordinate grid"}, 45 53 {1, "coords", coords, "load coordinates for buffer from file"}, 54 {1, "cdot", cdot, "plot point in sky coordinates"}, 46 55 {1, "cplot", cplot, "plot vectors in sky coordinates"}, 47 56 {1, "csystem", csystem, "convert between coordinate systems"}, … … 61 70 {1, "medianmap", medianmap, "small median image"}, 62 71 {1, "mkgauss", mkgauss, "generate a 2-D gaussian centered in image"}, 72 {1, "mksersic", mksersic, "generate a 2-D sersic profile"}, 73 {1, "galsectors", galsectors, "generate radial vectors for sectors of width dtheta"}, 74 {1, "galprofiles", galprofiles, "generate radial vectors with interpolation along paths"}, 75 {1, "galradius", galradius, "generate radial vectors with interpolation along paths"}, 76 {1, "galradbins", galradbins, "generate radial vectors with interpolation along paths"}, 77 {1, "elliprofile", elliprofile, "generate radial vectors with interpolation along paths"}, 78 {1, "petrosian", petrosian, "petrosian parameters given radial bins"}, 63 79 {1, "multifit", multifit, "fit multi-order spectrum"}, 64 80 {1, "objload", objload, "plot obj data on Ximage "}, -
trunk/Ohana/src/opihi/cmd.astro/region.c
r14590 r25757 6 6 double Ra, Dec, Radius; 7 7 float dx, dy; 8 int N, kapa ;8 int N, kapa, NoClear; 9 9 char *name; 10 10 Graphdata graphmode; … … 46 46 remove_argument (N, &argc, argv); 47 47 graphmode.flipnorth = FALSE; 48 } 49 50 NoClear = FALSE; 51 if ((N = get_argument (argc, argv, "-no-clear"))) { 52 remove_argument (N, &argc, argv); 53 NoClear = TRUE; 48 54 } 49 55 … … 122 128 graphmode.coords.cdelt1 = graphmode.coords.cdelt2 = 1.0; 123 129 124 KapaClearSections (kapa);130 if (!NoClear) KapaClearSections (kapa); 125 131 KapaSetLimits (kapa, &graphmode); 126 132 127 133 /* drop this? */ 128 sprintf (string, "%8.4f %8.4f (%f)", Ra, Dec, Radius);129 KapaSendLabel (kapa, string, 2);134 // sprintf (string, "%8.4f %8.4f (%f)", Ra, Dec, Radius); 135 // KapaSendLabel (kapa, string, 2); 130 136 131 137 // XXX is this the right thing to be doing? -
trunk/Ohana/src/opihi/cmd.basic/substr.c
r18705 r25757 16 16 // add a range check here 17 17 if ((N1 < 0) || (N1 >= strlen(argv[1]))) { 18 gprint (GP_ERR, "ERROR: N1 out of range\n");18 gprint (GP_ERR, "ERROR: start value out of range in substr command\n"); 19 19 return (FALSE); 20 20 } 21 21 if ((N2 < 0) || ((N2+N1) > strlen(argv[1]))) { 22 gprint (GP_ERR, "ERROR: N2 out of range\n");22 gprint (GP_ERR, "ERROR: end value out of range in substr command\n"); 23 23 return (FALSE); 24 24 } -
trunk/Ohana/src/opihi/cmd.data/Makefile
r21508 r25757 97 97 $(SRC)/rebin.$(ARCH).o \ 98 98 $(SRC)/resize.$(ARCH).o \ 99 $(SRC)/relocate.$(ARCH).o \ 99 100 $(SRC)/roll.$(ARCH).o \ 100 101 $(SRC)/rotate.$(ARCH).o \ … … 110 111 $(SRC)/style.$(ARCH).o \ 111 112 $(SRC)/subraster.$(ARCH).o \ 112 $(SRC)/subset.$(ARCH).o \113 $(SRC)/subset.$(ARCH).o \ 113 114 $(SRC)/svd.$(ARCH).o \ 114 115 $(SRC)/swapbytes.$(ARCH).o \ … … 118 119 $(SRC)/tvcolors.$(ARCH).o \ 119 120 $(SRC)/tvcontour.$(ARCH).o \ 120 $(SRC)/tvgrid.$(ARCH).o \121 $(SRC)/tvgrid.$(ARCH).o \ 121 122 $(SRC)/uniq.$(ARCH).o \ 122 $(SRC)/unsign.$(ARCH).o \123 $(SRC)/unsign.$(ARCH).o \ 123 124 $(SRC)/vbin.$(ARCH).o \ 125 $(SRC)/vgroup.$(ARCH).o \ 124 126 $(SRC)/vclip.$(ARCH).o \ 125 $(SRC)/vgauss.$(ARCH).o \ 126 $(SRC)/vmaxwell.$(ARCH).o \ 127 $(SRC)/vgauss.$(ARCH).o \ 128 $(SRC)/vellipse.$(ARCH).o \ 129 $(SRC)/vmaxwell.$(ARCH).o \ 127 130 $(SRC)/vgrid.$(ARCH).o \ 128 131 $(SRC)/vload.$(ARCH).o \ … … 130 133 $(SRC)/vpop.$(ARCH).o \ 131 134 $(SRC)/vroll.$(ARCH).o \ 132 $(SRC)/vsmooth.$(ARCH).o \135 $(SRC)/vsmooth.$(ARCH).o \ 133 136 $(SRC)/vstats.$(ARCH).o \ 134 137 $(SRC)/wd.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r24219 r25757 85 85 int rebin PROTO((int, char **)); 86 86 int resize PROTO((int, char **)); 87 int relocate PROTO((int, char **)); 87 88 int roll PROTO((int, char **)); 88 89 int rotate PROTO((int, char **)); … … 110 111 int unsign PROTO((int, char **)); 111 112 int vbin PROTO((int, char **)); 113 int vgroup PROTO((int, char **)); 112 114 int vclip PROTO((int, char **)); 113 115 int vect_select PROTO((int, char **)); 114 116 int vgrid PROTO((int, char **)); 115 117 int vgauss PROTO((int, char **)); 118 int vellipse PROTO((int, char **)); 116 119 int vmaxwell PROTO((int, char **)); 117 120 int vload PROTO((int, char **)); … … 218 221 {1, "rebin", rebin, "rebin image data by factor of N"}, 219 222 {1, "resize", resize, "set graphics/image window size"}, 223 {1, "relocate", relocate, "set graphics/image window position"}, 220 224 {1, "roll", roll, "roll image to new start point"}, 221 225 {1, "rotate", rotate, "rotate image"}, … … 243 247 {1, "uniq", uniq, "create a uniq vector subset from a vector"}, 244 248 {1, "unsign", unsign, "toggle the UNSIGN status"}, 245 {1, "vbin", vbin, "rebin vector data by a fector of N"}, 249 {1, "vbin", vbin, "rebin vector data by a factor of N"}, 250 {1, "vgroup", vgroup, "group y vector into bins defined by x vector values"}, 246 251 {1, "vclip", vclip, "clip values in a vector to be within a range"}, 247 252 {1, "vectors", list_vectors, "list vectors"}, 248 253 {1, "vgauss", vgauss, "fit a Gaussian to a vector"}, 254 {1, "vellipse", vellipse, "fit a Ellipse to a vector pair"}, 249 255 {1, "vgrid", vgrid, "generate an image from a triplet of vectors"}, 250 256 {1, "vhistogram", histogram, "generate histogram from vector"}, -
trunk/Ohana/src/opihi/cmd.data/subset.c
r20936 r25757 6 6 7 7 char *out; 8 int i, Npts, size ;8 int i, Npts, size, valid; 9 9 Vector *ivec, *ovec, *tvec; 10 10 … … 12 12 ivec = ovec = tvec = NULL; 13 13 14 if ((argc < 6) || strcmp(argv[2], "=") || strcmp (argv[4], "if")) { 15 gprint (GP_ERR, "SYNTAX: subset vec = vec if (logic expression)\n"); 14 valid = TRUE; 15 valid &= (argc >= 6); 16 valid &= !strcmp(argv[2], "="); 17 valid &= !strcmp(argv[4], "if") || !strcmp (argv[4], "where"); 18 if (!valid) { 19 gprint (GP_ERR, "SYNTAX: subset vec = vec [if/where] (logic expression)\n"); 16 20 return (FALSE); 17 21 } … … 76 80 return (TRUE); 77 81 78 error:82 error: 79 83 DeleteVector (tvec); 80 84 DeleteVector (ovec); -
trunk/Ohana/src/opihi/cmd.data/tvcolors.c
r16059 r25757 19 19 if (argc != 2) { 20 20 gprint (GP_ERR, "USAGE: tvcolors (colormap)\n"); 21 gprint (GP_ERR, " colormap options : greyscale, -greyscale, rainbow, heat, fullcolor, ruffcolor (also grayscale, -grayscale)\n"); 21 22 return (FALSE); 22 23 } -
trunk/Ohana/src/opihi/dvo/Makefile
r20936 r25757 73 73 $(SRC)/imrough.$(ARCH).o \ 74 74 $(SRC)/imsearch.$(ARCH).o \ 75 $(SRC)/imstats.$(ARCH).o \76 75 $(SRC)/lcat.$(ARCH).o \ 77 76 $(SRC)/lcurve.$(ARCH).o \ -
trunk/Ohana/src/opihi/dvo/gimages.c
r21508 r25757 124 124 } 125 125 126 // find coordinates of image center 126 127 XY_to_RD (&Ro, &Do, Xo, Yo, &image[i].coords); 128 if (fabs(Ro - Ra) > 120.0) continue; 127 129 128 130 local.crval1 = Ro; … … 138 140 Xs = -0.5*image[i].NX; 139 141 Ys = -0.5*image[i].NY; 140 Xe = +0.5*image[i].NX;141 Ye = +0.5*image[i].NY;142 142 } else { 143 143 Xs = 0.0; 144 144 Ys = 0.0; 145 Xe = image[i].NX;146 Ye = image[i].NY;147 145 } 148 146 147 // find coordinates of an image corner 149 148 XY_to_RD (&Ro, &Do, Xs, Ys, &image[i].coords); 150 RD_to_XY (&Xo, &Xo, Ro, Do, &local); 149 150 // find radius of image in arcsec 151 RD_to_XY (&Xo, &Yo, Ro, Do, &local); 151 152 Radius = hypot (Xo, Yo); 152 153 // fprintf (stderr, "%s: %f %f %f ", image[i].name, local.crval1, local.crval2, Radius); 153 154 154 XY_to_RD (&Ro, &Do, Xs, Ye, &image[i].coords); 155 RD_to_XY (&Xo, &Xo, Ro, Do, &local); 156 Radius = MAX (Radius, hypot (Xo, Yo)); 157 // fprintf (stderr, "%f ", Radius); 158 159 XY_to_RD (&Ro, &Do, Xe, Ys, &image[i].coords); 160 RD_to_XY (&Xo, &Xo, Ro, Do, &local); 161 Radius = MAX (Radius, hypot (Xo, Yo)); 162 // fprintf (stderr, "%f ", Radius); 163 164 XY_to_RD (&Ro, &Do, Xe, Ye, &image[i].coords); 165 RD_to_XY (&Xo, &Xo, Ro, Do, &local); 166 Radius = MAX (Radius, hypot (Xo, Yo)); 167 // fprintf (stderr, "%f ", Radius); 168 155 // check for distances to coordinates in arcsec 169 156 RD_to_XY (&Xo, &Yo, Ra, Dec, &local); 170 157 // fprintf (stderr, " : %f\n", hypot(Xo,Yo)); 158 159 // skip images with center too far from coordinaes 171 160 if (hypot(Xo,Yo) > 1.5*Radius) continue; 172 161 // fprintf (stderr, " ** try me **\n"); -
trunk/Ohana/src/opihi/dvo/imbox.c
r21065 r25757 3 3 int imbox (int argc, char **argv) { 4 4 5 int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU ;5 int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU, Npts, NPTS; 6 6 Vector Xvec, Yvec; 7 7 double r, d, x[4], y[4], Rmin, Rmax, Rmid; … … 36 36 37 37 /* project this image to screen display coords */ 38 SetVector (&Xvec, OPIHI_FLT, 8); 39 SetVector (&Yvec, OPIHI_FLT, 8); 38 Npts = 0; 39 NPTS = 200; 40 SetVector (&Xvec, OPIHI_FLT, NPTS); 41 SetVector (&Yvec, OPIHI_FLT, NPTS); 40 42 41 43 while (gfits_fread_header (f, &header)) { … … 82 84 while (r > Rmid) r-= 360.0; 83 85 } 84 status |= RD_to_XY (&Xvec.elements.Flt[ 2*j], &Yvec.elements.Flt[2*j], r, d, &graphmode.coords);86 status |= RD_to_XY (&Xvec.elements.Flt[Npts + 2*j], &Yvec.elements.Flt[Npts + 2*j], r, d, &graphmode.coords); 85 87 if (j > 0) { 86 Xvec.elements.Flt[ 2*j - 1] = Xvec.elements.Flt[2*j];87 Yvec.elements.Flt[ 2*j - 1] = Yvec.elements.Flt[2*j];88 Xvec.elements.Flt[Npts + 2*j - 1] = Xvec.elements.Flt[Npts + 2*j]; 89 Yvec.elements.Flt[Npts + 2*j - 1] = Yvec.elements.Flt[Npts + 2*j]; 88 90 } 89 91 } 90 Xvec.elements.Flt[7] = Xvec.elements.Flt[0]; 91 Yvec.elements.Flt[7] = Yvec.elements.Flt[0]; 92 Xvec.elements.Flt[Npts + 7] = Xvec.elements.Flt[Npts + 0]; 93 Yvec.elements.Flt[Npts + 7] = Yvec.elements.Flt[Npts + 0]; 94 92 95 InPic = FALSE; 93 96 for (j = 0; j < 8; j+=2) { 94 if ((Xvec.elements.Flt[j] >= graphmode.xmin) && 95 (Xvec.elements.Flt[j] <= graphmode.xmax) && 96 (Yvec.elements.Flt[j] >= graphmode.ymin) && 97 (Yvec.elements.Flt[j] <= graphmode.ymax)) 98 InPic = TRUE; 97 if ((Xvec.elements.Flt[Npts + j] >= graphmode.xmin) && 98 (Xvec.elements.Flt[Npts + j] <= graphmode.xmax) && 99 (Yvec.elements.Flt[Npts + j] >= graphmode.ymin) && 100 (Yvec.elements.Flt[Npts + j] <= graphmode.ymax)) 101 InPic = TRUE; 102 } 103 if (!InPic) continue; 104 105 Npts += 8; 106 if (Npts + 8 >= NPTS) { /* need to leave room for 4 point image */ 107 NPTS += 200; 108 REALLOCATE (Xvec.elements.Flt, opihi_flt, NPTS); 109 REALLOCATE (Yvec.elements.Flt, opihi_flt, NPTS); 99 110 } 100 111 101 Xvec.Nelements = Yvec.Nelements = 8;102 if (InPic) {103 graphmode.style = 2; /* points */104 graphmode.ptype = 100; /* connect pairs of points */105 graphmode.etype = 0;106 PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);107 }108 112 skip: 109 113 Nskip = gfits_data_size (&header); … … 111 115 gfits_free_header (&header); 112 116 } 117 118 Xvec.Nelements = Yvec.Nelements = Npts; 119 if (Npts > 0) { 120 graphmode.style = 2; /* points */ 121 graphmode.ptype = 100; /* connect pairs of points */ 122 graphmode.etype = 0; 123 PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode); 124 } 125 113 126 fclose (f); 114 127 free (Xvec.elements.Flt); -
trunk/Ohana/src/opihi/dvo/init.c
r21541 r25757 102 102 {1, "subpix", subpix, "get subpixel positions"}, 103 103 {1, "version", version, "show version information"}, 104 //{1, "imstats", imstats, "plot image statistics"},105 104 //{1, "addxtra", addxtra, "add extra data to object"}, 106 105 //{1, "getxtra", getxtra, "get extra data from object"}, -
trunk/Ohana/src/opihi/dvo/photometry.c
r21508 r25757 325 325 return (FALSE); 326 326 } 327 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 327 328 // XXX now that DVO does not allow write access, we can drop the MasterPhotcodeFile 329 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, FALSE)) { 328 330 gprint (GP_ERR, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 329 331 return (FALSE); -
trunk/Ohana/src/opihi/dvo/region_list.c
r15753 r25757 42 42 43 43 if (sky != NULL) SkyTableFree (sky); 44 sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, skydepth, verbose);44 sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, FALSE, skydepth, verbose); 45 45 if (sky == NULL) return FALSE; 46 46 -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r21153 r25757 16 16 Coords coords; 17 17 int typehash; 18 int PhotcodeSelect; 19 PhotCode *PhotcodeValue; 18 20 19 21 WITH_MOSAIC = FALSE; … … 43 45 remove_argument (N, &argc, argv); 44 46 ByName = TRUE; 47 } 48 49 PhotcodeValue = NULL; 50 PhotcodeSelect = FALSE; 51 if ((N = get_argument (argc, argv, "-photcode"))) { 52 if (!InitPhotcodes ()) return (FALSE); 53 PhotcodeSelect = TRUE; 54 remove_argument (N, &argc, argv); 55 PhotcodeValue = GetPhotcodebyName (argv[N]); 56 if (PhotcodeValue == NULL) { 57 gprint (GP_ERR, "photcode not found in photcode table\n"); 58 return (FALSE); 59 } 60 remove_argument (N, &argc, argv); 45 61 } 46 62 … … 85 101 86 102 if (argc != 4) { 87 gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (Npts) [-time start range] [-name name]\n"); 103 gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (Npts)\n"); 104 gprint (GP_ERR, " options: [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic] [-ra-center RA]\n"); 88 105 gprint (GP_ERR, " (buffer) saves bitmapped AIT plot\n"); 89 106 gprint (GP_ERR, " (pixscale) specifies the pixel size in degrees\n"); … … 128 145 for (xs = 0; xs < Nx; xs++) { 129 146 status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords); 130 status &= (r > 0);131 status &= (r < 360);147 status &= (r >= 0); 148 status &= (r <= 360); 132 149 if (status) { 133 150 V[ys*Nx + xs] = 2; … … 141 158 if (ByName && strcmp (name, image[i].name)) continue; 142 159 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 160 161 if (PhotcodeSelect) { 162 if (PhotcodeValue[0].type == PHOT_DEP) { 163 if (PhotcodeValue[0].code != image[i].photcode) continue; 164 } else { 165 if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue; 166 } 167 } 168 143 169 if (!FindMosaicForImage (image, Nimage, i)) continue; 144 170 … … 167 193 XY_to_RD (&r, &d, Xi, Yi, &image[i].coords); 168 194 r = ohana_normalize_angle (r); 195 if (r - RaCenter > +180.0) r -= 360.0; 196 if (r - RaCenter < -180.0) r += 360.0; 169 197 status = RD_to_XY (&Xs, &Ys, r, d, &coords); 170 198 if (Xs < 0) continue; -
trunk/Ohana/src/opihi/lib.data/mrqmin.c
r20936 r25757 17 17 18 18 int k, j, i; 19 opihi_flt y diff, wt, chisq;19 opihi_flt ymodel, ydiff, wt, chisq; 20 20 21 21 for (j = 0; j < Npar; j++) { … … 27 27 for (i = 0; i < Npts; i++) { 28 28 29 ydiff = funcs (x[i], par, Npar, dyda) - y[i]; 29 ymodel = funcs (x[i], par, Npar, dyda); 30 ydiff = ymodel - y[i]; 30 31 chisq += SQ(ydiff) * dy[i]; 32 33 // fprintf (stderr, "%f %f - %f : %f -> %f\n", x[i], y[i], ymodel, dy[i], chisq); 31 34 32 35 for (j = 0; j < Npar; j++) { … … 85 88 86 89 /* if good, save temp values */ 87 if ( rho > 0) {90 if ((chisq > 1e-3) && (rho > -1e-6)) { 88 91 lambda *= 0.1; 89 92 ochisq = chisq; -
trunk/Ohana/src/photdbc/src/ConfigInit.c
r17284 r25757 64 64 /* XXX this does not yet write out the master photcode table */ 65 65 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 66 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {66 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 67 67 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 68 68 exit (1); -
trunk/Ohana/src/photdbc/src/photdbc.c
r17284 r25757 17 17 18 18 // the output catalog needs to inherit the SKY_DEPTH of the input catalog 19 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);19 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, TRUE, SKY_DEPTH_HST, VERBOSE); 20 20 SkyTableSetFilenames (sky, CATDIR, "cpt"); 21 21 skylist = SkyListByPatch (sky, -1, ®ION); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r24308 r25757 60 60 /* update master photcode table if not defined */ 61 61 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 62 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {62 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 63 63 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 64 64 exit (1); -
trunk/Ohana/src/relastro/src/load_images.c
r12332 r25757 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
trunk/Ohana/src/relastro/src/relastro_objects.c
r24308 r25757 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
trunk/Ohana/src/relphot/src/ConfigInit.c
r20323 r25757 58 58 /* XXX this does not yet write out the master photcode table */ 59 59 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 60 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {60 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 61 61 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 62 62 exit (1); -
trunk/Ohana/src/relphot/src/load_images.c
r10506 r25757 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
trunk/Ohana/src/relphot/src/relphot_objects.c
r25733 r25757 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
trunk/Ohana/src/tools/src/mktemp.c
r12333 r25757 1 1 # include <stdio.h> 2 2 # include <stdlib.h> 3 # include <string.h> 4 5 # define FALSE 0 6 # define TRUE 1 3 7 4 8 int main (int argc, char **argv) { 5 9 6 if (argc != 2) { 7 fprintf (stderr, "USAGE: %s (template)\n", argv[0]); 8 exit (1); 10 int i, j, Ntotal; 11 char *tmpdir, *template, deftemplate[32], *prefix, defprefix[32], *filename; 12 int make_directory, fail_silently, unsafe_mode, full_path; 13 14 tmpdir = NULL; 15 prefix = NULL; 16 template = NULL; 17 filename = NULL; 18 19 make_directory = FALSE; 20 fail_silently = FALSE; 21 unsafe_mode = FALSE; 22 full_path = TRUE; 23 24 for (i = 1; i < argc; i++) { 25 // -options must be first 26 if (argv[i][0] == '-') { 27 if (!strcmp(argv[i], "-V")) { 28 fprintf (stdout, "mktemp version Ohana $Revision: $\n"); 29 exit (0); 30 } 31 if (!strcmp(argv[i], "-p")) { 32 if (argc <= i + 1) usage(); 33 i++; 34 prefix = argv[i]; 35 full_path = FALSE; 36 continue; 37 } 38 for (j = 1; j < strlen(argv[i]); j++) { 39 if (argv[i][j] == 'q') { 40 fail_silently = TRUE; 41 continue; 42 } 43 if (argv[i][j] == 't') { 44 full_path = FALSE; 45 continue; 46 } 47 if (argv[i][j] == 'd') { 48 // make directory 49 make_directory = TRUE; 50 continue; 51 } 52 if (argv[i][j] == 'u') { 53 unsafe_mode = TRUE; 54 continue; 55 } 56 // unknown option 57 usage(); 58 } 59 continue; 60 } 61 // report an error if too many arguments are given 62 if (template) usage(); 63 template = argv[i]; 9 64 } 10 65 11 if (mkstemp (argv[1]) == -1) exit (1); 66 if (!full_path) { 67 // prefix = TMPDIR ? TMPDIR : (prefix ? prefix : /tmp) 68 tmpdir = getenv("TMPDIR"); 69 if (tmpdir) { 70 prefix = tmpdir; 71 } 72 if (!prefix) { 73 strcpy (defprefix, "/tmp"); 74 prefix = defprefix; 75 } 76 if (template && strchr(template, '/')) usage(); 77 } 12 78 13 fprintf (stdout, "%s\n", argv[1]); 79 if (!template) { 80 if (full_path) { 81 strcpy (deftemplate, "/tmp/tmp.XXXXXXXXXX"); 82 } else { 83 strcpy (deftemplate, "tmp.XXXXXXXXXX"); 84 } 85 template = deftemplate; 86 } 87 88 // filename = full_path ? prefix/template : template; 89 if (!full_path) { 90 Ntotal = strlen(prefix) + strlen(template) + 2; 91 filename = (char *) malloc (Ntotal); 92 snprintf (filename, Ntotal, "%s/%s", prefix, template); 93 template = filename; 94 } 95 96 if (make_directory) { 97 if (mkdtemp (template) == -1) { 98 if (!fail_silently) fprintf (stderr, "failed to make temp file from %s\n", template); 99 exit (1); 100 } 101 } else { 102 if (mkstemp (template) == -1) { 103 if (!fail_silently) fprintf (stderr, "failed to make temp file from %s\n", template); 104 exit (1); 105 } 106 } 107 108 fprintf (stdout, "%s\n", template); 14 109 15 110 exit (0); 16 111 } 17 112 113 usage() { 114 fprintf (stderr, "Usage: mktemp [-V] | [-dqtu] [-p prefix] [template]\n"); 115 exit (1); 116 } -
trunk/Ohana/src/uniphot/src/ConfigInit.c
r12332 r25757 36 36 /* XXX this does not yet write out the master photcode table */ 37 37 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 38 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {38 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 39 39 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 40 40 exit (1);
Note:
See TracChangeset
for help on using the changeset viewer.
