Changeset 10966
- Timestamp:
- Jan 8, 2007, 12:30:21 PM (19 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 8 edited
-
pmFPAMosaic.c (modified) (1 diff)
-
pmFPAWrite.c (modified) (2 diffs)
-
pmFPAfile.c (modified) (1 diff)
-
pmFPAfile.h (modified) (2 diffs)
-
pmFPAfileDefine.c (modified) (19 diffs)
-
pmFPAfileDefine.h (modified) (9 diffs)
-
pmFPAfileIO.c (modified) (6 diffs)
-
pmFPAfileIO.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMosaic.c
r10713 r10966 1045 1045 psFree(chipRegion); 1046 1046 1047 // Currently, there's nothing interesting in the chip concepts that needs to be updated. 1048 1049 // Copy the concepts for the target FPA 1050 target->parent->concepts = psMetadataCopy(target->parent->concepts, source->parent->concepts); 1047 // Copy the concepts 1048 target->concepts = psMetadataCopy(target->concepts, source->concepts); // Chip level 1049 target->parent->concepts = psMetadataCopy(target->parent->concepts, source->parent->concepts); // FPA lvl 1051 1050 1052 1051 // Now make a new readout to go in the target cell -
trunk/psModules/src/camera/pmFPAWrite.c
r10526 r10966 141 141 pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS | 142 142 PM_CONCEPT_SOURCE_DEFAULTS; 143 if (!pmConceptsWriteCell(cell, source, false, NULL)) {143 if (!pmConceptsWriteCell(cell, source, true, NULL)) { 144 144 psError(PS_ERR_IO, false, "Unable to write concepts for cell.\n"); 145 145 return false; … … 191 191 pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS | 192 192 PM_CONCEPT_SOURCE_DEFAULTS; 193 if (!pmConceptsWriteChip(chip, source, false, true, NULL)) {193 if (!pmConceptsWriteChip(chip, source, true, true, NULL)) { 194 194 psError(PS_ERR_IO, false, "Unable to write concepts for chip.\n"); 195 195 return false; -
trunk/psModules/src/camera/pmFPAfile.c
r10918 r10966 66 66 file->header = NULL; 67 67 68 file->fileLevel = PM_FPA_LEVEL_NONE; 69 file->dataLevel = PM_FPA_LEVEL_NONE; 70 file->freeLevel = PM_FPA_LEVEL_NONE; 71 file->mosaicLevel = PM_FPA_LEVEL_NONE; 72 68 73 file->fpa = NULL; 69 74 file->fits = NULL; -
trunk/psModules/src/camera/pmFPAfile.h
r10918 r10966 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-01-0 5 20:17:21 $9 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-01-08 22:30:21 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 63 63 pmFPAfileState state; // have we opened the file, etc? 64 64 65 // Desired levels, set by the user 65 66 pmFPALevel fileLevel; // what level in the FPA hierarchy represents a unique file? 66 67 pmFPALevel dataLevel; // at what level do we read/write the data segment? 67 68 pmFPALevel freeLevel; // at what level do we free the data segment? 69 pmFPALevel mosaicLevel; // at what level is the mosaic? 68 70 69 71 pmFPA *fpa; // for I/O files, we carry a pointer to the complete fpa -
trunk/psModules/src/camera/pmFPAfileDefine.c
r10724 r10966 30 30 31 31 // define an input-type pmFPAfile, bind to the optional fpa if supplied 32 pmFPAfile *pmFPAfileDefineInput(pmConfig *config, pmFPA *fpa, c har *name)32 pmFPAfile *pmFPAfileDefineInput(pmConfig *config, pmFPA *fpa, const char *name) 33 33 { 34 34 PS_ASSERT_PTR_NON_NULL(config, NULL); 35 35 PS_ASSERT_PTR_NON_NULL(config->files, NULL); 36 36 PS_ASSERT_PTR_NON_NULL(config->camera, NULL); 37 PS_ASSERT_PTR_NON_NULL(name, NULL); 38 PS_ASSERT_INT_POSITIVE(strlen(name), NULL); 37 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 39 38 40 39 bool status; … … 50 49 // select the name from the FILERULES 51 50 // check for alias name (type == STR, name is aliased name) 52 c har *realname = psMetadataLookupStr (&status, filerules, name);51 const char *realname = psMetadataLookupStr (&status, filerules, name); 53 52 if (!realname || strlen(realname) == 0) { 54 53 realname = name; … … 107 106 108 107 // define a pmFPAfile, bind to the optional fpa if supplied 109 pmFPAfile *pmFPAfileDefineOutput(pmConfig *config, pmFPA *fpa, c har *name)108 pmFPAfile *pmFPAfileDefineOutput(pmConfig *config, pmFPA *fpa, const char *name) 110 109 { 111 110 PS_ASSERT_PTR_NON_NULL(config, NULL); 112 111 PS_ASSERT_PTR_NON_NULL(config->files, NULL); 113 112 PS_ASSERT_PTR_NON_NULL(config->camera, NULL); 114 PS_ASSERT_PTR_NON_NULL(name, NULL); 115 PS_ASSERT_INT_POSITIVE(strlen(name), NULL); 113 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 116 114 117 115 bool status; 118 char *type;119 116 120 117 // select the FILERULES from the camera config … … 127 124 // select the name from the FILERULES 128 125 // check for alias name (type == STR, name is aliased name) 129 c har *realname = psMetadataLookupStr (&status, filerules, name);126 const char *realname = psMetadataLookupStr (&status, filerules, name); 130 127 if (!realname || strlen(realname) == 0) { 131 128 realname = name; … … 148 145 file->extxtra = psMemIncrRefCounter(psMetadataLookupStr (&status, data, "EXTNAME.XTRA")); 149 146 150 type = psMetadataLookupStr (&status, data, "FILE.TYPE");147 const char *type = psMetadataLookupStr (&status, data, "FILE.TYPE"); 151 148 file->type = pmFPAfileTypeFromString(type); 152 149 if (file->type == PM_FPA_FILE_NONE) { … … 188 185 } 189 186 187 #if 0 190 188 // for WRITE type of data, the output format needs to be determined 191 189 // this is only needed if the output file is not identical in structure to the input? … … 231 229 psFree (words); 232 230 } 231 #endif 233 232 234 233 // add argument-supplied OUTPUT name to this file … … 248 247 // save the pmFPAfile on config->files 249 248 // return the pmFPAfile (a view to the one saved on config->files) 250 pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, c har *filename,char *argname)249 pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, const char *filename, const char *argname) 251 250 { 252 251 PS_ASSERT_PTR_NON_NULL(config, NULL); 253 PS_ASSERT_PTR_NON_NULL(filename, NULL); 254 PS_ASSERT_INT_POSITIVE(strlen(filename), NULL); 255 PS_ASSERT_PTR_NON_NULL(argname, NULL); 256 PS_ASSERT_INT_POSITIVE(strlen(argname), NULL); 252 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 253 PS_ASSERT_STRING_NON_EMPTY(argname, NULL); 257 254 258 255 bool status; … … 269 266 psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname); 270 267 if (!status) { 271 psTrace("psModules.camera", 5, "Failed to find %s in argument list", argname); 268 // psTrace("psModules.camera", 5, "Failed to find %s in argument list", argname); 269 psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to find %s in argument list", argname); 272 270 return NULL; 273 271 } … … 296 294 return NULL; 297 295 } 298 psFitsClose (fits);296 psFitsClose(fits); 299 297 300 298 // determine the current format from the header … … 417 415 // save the pmFPAfiles on config->files 418 416 // return the pmFPAfiles (a view to the one saved on config->files) 419 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, char *filename, char *argname, int entry) 417 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, const char *filename, 418 const char *argname, int entry) 420 419 { 421 420 PS_ASSERT_PTR_NON_NULL(config, NULL); 422 PS_ASSERT_PTR_NON_NULL(filename, NULL); 423 PS_ASSERT_INT_POSITIVE(strlen(filename), NULL); 424 PS_ASSERT_PTR_NON_NULL(argname, NULL); 425 PS_ASSERT_INT_POSITIVE(strlen(argname), NULL); 421 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 422 PS_ASSERT_STRING_NON_EMPTY(argname, NULL); 426 423 427 424 bool status; … … 533 530 // define the named pmFPAfile from the camera->config 534 531 // only valid for pmFPAfile->mode = READ 535 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, c har *filename)532 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, const char *filename) 536 533 { 537 534 PS_ASSERT_PTR_NON_NULL(config, false); 538 PS_ASSERT_PTR_NON_NULL(filename, false); 539 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 535 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 540 536 541 537 if (*found) { … … 603 599 // save the pmFPAfile on config->files 604 600 // return the pmFPAfile (a view to the one saved on config->files) 605 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, char *filename, pmFPA *input, pmDetrendType type) 601 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, const char *filename, 602 pmFPA *input, pmDetrendType type) 606 603 { 607 604 PS_ASSERT_PTR_NON_NULL(input, NULL); … … 609 606 PS_ASSERT_PTR_NON_NULL(config->camera, NULL); 610 607 PS_ASSERT_PTR_NON_NULL(config->files, NULL); 611 PS_ASSERT_ PTR_NON_NULL(filename, NULL);608 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 612 609 613 610 pmFPA *fpa = NULL; … … 681 678 // create a new output pmFPAfile based on an existing FPA 682 679 // only valid for pmFPAfile->mode == WRITE (or internal?) 683 pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, c har *filename)680 pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, const char *filename) 684 681 { 685 682 PS_ASSERT_PTR_NON_NULL(config, false); 686 683 PS_ASSERT_PTR_NON_NULL(src, false); 687 PS_ASSERT_PTR_NON_NULL(filename, false); 688 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 689 690 pmFPA *fpa = pmFPAConstruct (src->camera); 684 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 685 686 // Need to look up the format 687 bool mdok; // Status of MD lookup 688 psMetadata *formats = psMetadataLookupMetadata(&mdok, src->camera, "FORMATS"); // The FORMATS 689 if (!mdok || !formats) { 690 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n", 691 config->cameraName); 692 return NULL; 693 } 694 psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format 695 if (!mdok || !format) { 696 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n", 697 config->formatName, config->cameraName); 698 return NULL; 699 } 700 701 pmFPA *fpa = pmFPAConstruct(src->camera); 691 702 pmFPAfile *file = pmFPAfileDefineOutput (config, fpa, filename); 692 703 if (!file) { … … 697 708 file->xBin = xBin; 698 709 file->yBin = yBin; 710 file->format = psMemIncrRefCounter(format); 699 711 700 712 psFree (fpa); … … 704 716 // create a new output pmFPAfile based on an existing FPA 705 717 // only valid for pmFPAfile->mode == WRITE (or internal?) 706 pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, c har *filename)718 pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, const char *filename) 707 719 { 708 720 PS_ASSERT_PTR_NON_NULL(config, false); 709 PS_ASSERT_PTR_NON_NULL(filename, false); 710 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 721 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 711 722 712 723 pmFPAfile *file = pmFPAfileDefineOutput (config, NULL, filename); … … 724 735 } 725 736 737 pmFPAfile *pmFPAfileDefineChipMosaic(pmConfig *config, pmFPA *src, const char *filename) 738 { 739 PS_ASSERT_PTR_NON_NULL(config, NULL); 740 PS_ASSERT_PTR_NON_NULL(src, NULL); 741 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 742 PS_ASSERT_STRING_NON_EMPTY(config->cameraName, NULL); 743 PS_ASSERT_STRING_NON_EMPTY(config->formatName, NULL); 744 745 if (config->cameraName[0] == '_' && 746 strcmp(config->cameraName + strlen(config->cameraName) - 5, "-CHIP") == 0) { 747 // The input camera has already been mosaicked to this level 748 pmFPAfile *file = pmFPAfileDefineOutput(config, NULL, filename); 749 file->camera = psMemIncrRefCounter(config->camera); 750 file->format = psMemIncrRefCounter(config->format); 751 file->fpa = pmFPAConstruct(file->camera); 752 return file; 753 } 754 755 // Find the correct camera configuration 756 bool mdok; // Status of MD lookup 757 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->site, "CAMERAS"); // Camera configurations 758 if (!mdok || !cameras) { 759 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the site configuration.\n"); 760 return NULL; 761 } 762 psString name = NULL; // Name of the new (automatically-generated) camera configuration 763 psStringAppend(&name, "_%s-CHIP", config->cameraName); 764 psMetadata *camera = psMetadataLookupMetadata(&mdok, cameras, name); // Camera configuration of interest 765 if (!mdok || !camera) { 766 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find automatically generated " 767 "camera configuration %s in site configuration.\n", name); 768 psFree(name); 769 return NULL; 770 } 771 psFree(name); 772 773 // Need to look up the format of the same name, but under the mosaic camera 774 psMetadata *formats = psMetadataLookupMetadata(&mdok, camera, "FORMATS"); // The FORMATS 775 if (!mdok || !formats) { 776 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n", 777 config->cameraName); 778 return NULL; 779 } 780 psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format 781 if (!mdok || !format) { 782 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n", 783 config->formatName, config->cameraName); 784 return NULL; 785 } 786 787 pmFPA *fpa = pmFPAConstruct(camera); 788 if (!fpa) { 789 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate mosaicked camera.\n"); 790 return NULL; 791 } 792 pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, filename); 793 if (!file) { 794 psErrorStackPrint(stderr, "file %s not defined\n", filename); 795 return NULL; 796 } 797 file->src = src; // inherit output elements from this source pmFPA 798 file->mosaicLevel = PM_FPA_LEVEL_CHIP; // don't do any I/O on this at a lower level 799 file->format = psMemIncrRefCounter(format); 800 801 psFree(fpa); 802 803 return file; 804 } 805 806 pmFPAfile *pmFPAfileDefineFPAMosaic(pmConfig *config, pmFPA *src, const char *filename) 807 { 808 PS_ASSERT_PTR_NON_NULL(config, NULL); 809 PS_ASSERT_PTR_NON_NULL(src, NULL); 810 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 811 PS_ASSERT_STRING_NON_EMPTY(config->cameraName, NULL); 812 813 if (config->cameraName[0] == '_' && 814 strcmp(config->cameraName + strlen(config->cameraName) - 4 , "-FPA") == 0) { 815 // The input camera has already been mosaicked to this level 816 pmFPAfile *file = pmFPAfileDefineOutput(config, NULL, filename); 817 file->camera = psMemIncrRefCounter(config->camera); 818 file->format = psMemIncrRefCounter(config->format); 819 file->fpa = pmFPAConstruct(file->camera); 820 return file; 821 } 822 823 // Find the correct camera configuration 824 bool mdok; // Status of MD lookup 825 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->site, "CAMERAS"); // Camera configurations 826 if (!mdok || !cameras) { 827 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the site configuration.\n"); 828 return NULL; 829 } 830 psString original; // Name of the original camera configuration 831 psString name = NULL; // Name of the new (automatically-generated) camera configuration 832 if (config->cameraName[0] == '_' && 833 strcmp(config->cameraName + strlen(config->cameraName) - 5 , "-CHIP") == 0) { 834 // It's a chip mosaic; we need to get the original name 835 original = psStringNCopy(config->cameraName + 1, strlen(config->cameraName) - 6); 836 } else { 837 original = psMemIncrRefCounter(config->cameraName); 838 } 839 psStringAppend(&name, "_%s-FPA", original); 840 psFree(original); 841 psMetadata *camera = psMetadataLookupMetadata(&mdok, cameras, name); // Camera configuration of interest 842 if (!mdok || !camera) { 843 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find automatically generated " 844 "camera configuration %s in site configuration.\n", name); 845 psFree(name); 846 return NULL; 847 } 848 psFree(name); 849 850 // Need to look up the format of the same name, but under the mosaic camera 851 psMetadata *formats = psMetadataLookupMetadata(&mdok, camera, "FORMATS"); // The FORMATS 852 if (!mdok || !formats) { 853 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n", 854 config->cameraName); 855 return NULL; 856 } 857 psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format 858 if (!mdok || !format) { 859 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n", 860 config->formatName, config->cameraName); 861 return NULL; 862 } 863 864 pmFPA *fpa = pmFPAConstruct(camera); 865 if (!fpa) { 866 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate mosaicked camera.\n"); 867 return NULL; 868 } 869 pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, filename); 870 if (!file) { 871 psErrorStackPrint(stderr, "file %s not defined\n", filename); 872 return NULL; 873 } 874 file->src = src; // inherit output elements from this source pmFPA 875 file->mosaicLevel = PM_FPA_LEVEL_FPA; // don't do any I/O on this at a lower level 876 file->format = psMemIncrRefCounter(format); 877 878 psFree(fpa); 879 880 return file; 881 } 882 726 883 // create a file with the given name, assign it type "INTERNAL", and supply it with an image 727 884 // of the requested dimensions. (image only, mask and weight are ignored) 728 pmReadout *pmFPAfileDefineInternal (psMetadata *files, c har *name, int Nx, int Ny, int type)885 pmReadout *pmFPAfileDefineInternal (psMetadata *files, const char *name, int Nx, int Ny, int type) 729 886 { 730 887 PS_ASSERT_PTR_NON_NULL(files, false); 731 PS_ASSERT_PTR_NON_NULL(name, false); 732 PS_ASSERT_INT_POSITIVE(strlen(name), false); 888 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 733 889 734 890 pmReadout *readout = pmReadoutAlloc(NULL); … … 748 904 } 749 905 750 bool pmFPAfileDropInternal(psMetadata *files, c har *name)906 bool pmFPAfileDropInternal(psMetadata *files, const char *name) 751 907 { 752 908 PS_ASSERT_PTR_NON_NULL(files, false); 753 PS_ASSERT_PTR_NON_NULL(name, false); 754 PS_ASSERT_INT_POSITIVE(strlen(name), false); 909 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 755 910 756 911 bool status = false; -
trunk/psModules/src/camera/pmFPAfileDefine.h
r10084 r10966 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $10 * @date $Date: 200 6-11-19 01:55:24$9 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-01-08 22:30:21 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 22 22 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 23 23 // reference count is held by the config->files metadata. 24 pmFPAfile *pmFPAfileDefineInput (pmConfig *config, pmFPA *fpa, c har *name);24 pmFPAfile *pmFPAfileDefineInput (pmConfig *config, pmFPA *fpa, const char *name); 25 25 26 26 // load the pmFPAfile information from the camera configuration data … … 28 28 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 29 29 // reference count is held by the config->files metadata. 30 pmFPAfile *pmFPAfileDefineOutput (pmConfig *config, pmFPA *fpa, c har *name);30 pmFPAfile *pmFPAfileDefineOutput (pmConfig *config, pmFPA *fpa, const char *name); 31 31 32 32 // look for the given argname on the argument list. find the give filename from the file rules … … 34 34 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 35 35 // reference count is held by the config->files metadata. 36 pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, c har *filename,char *argname);36 pmFPAfile *pmFPAfileDefineFromArgs (bool *found, pmConfig *config, const char *filename, const char *argname); 37 37 38 38 // look for the given argname on the argument list. find the give filename from the file rules … … 40 40 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 41 41 // reference count is held by the config->files metadata. 42 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, c har *filename);42 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, const char *filename); 43 43 44 44 // look for the given argname on the argument list. find the give filename from the file rules … … 46 46 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 47 47 // reference count is held by the config->files metadata. 48 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, char *filename, pmFPA *input, pmDetrendType type); 48 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, pmConfig *config, const char *filename, 49 pmFPA *input, pmDetrendType type); 49 50 50 51 // create a new output pmFPAfile based on an existing FPA … … 52 53 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 53 54 // reference count is held by the config->files metadata. 54 pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, c har *filename);55 pmFPAfile *pmFPAfileDefineFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, const char *filename); 55 56 56 57 // create a new output pmFPAfile based on an existing FPA … … 59 60 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 60 61 // reference count is held by the config->files metadata. 61 pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, char *filename); 62 pmFPAfile *pmFPAfileDefineNewCamera (pmConfig *config, const char *filename); 63 64 /// Create a new output pmFPAfile based upon a chip mosaic of an existing FPA 65 /// 66 /// The new pmFPAfile is inserted into the config->files metadata, freed and returned; so that the user does 67 /// not have to (and should not!) free the result. 68 pmFPAfile *pmFPAfileDefineChipMosaic(pmConfig *config, ///< Configuration data 69 pmFPA *src, ///< Source FPA 70 const char *filename ///< Output (root) filename 71 ); 72 73 /// Create a new output pmFPAfile based upon an FPA mosaic of an existing FPA 74 /// 75 /// The new pmFPAfile is inserted into the config->files metadata, freed and returned; so that the user does 76 /// not have to (and should not!) free the result. 77 pmFPAfile *pmFPAfileDefineFPAMosaic(pmConfig *config, ///< Configuration data 78 pmFPA *src, ///< Source FPA 79 const char *filename ///< Output (root) filename 80 ); 62 81 63 82 // create a file with the given name, assign it type "INTERNAL", and supply it with an image 64 83 // of the requested dimensions. (image only, mask and weight are ignored) 65 pmReadout *pmFPAfileDefineInternal (psMetadata *files, c har *name, int Nx, int Ny, int type);84 pmReadout *pmFPAfileDefineInternal (psMetadata *files, const char *name, int Nx, int Ny, int type); 66 85 67 86 // delete the INTERNAL file of the given name (if it exists) 68 bool pmFPAfileDropInternal (psMetadata *files, c har *name);87 bool pmFPAfileDropInternal (psMetadata *files, const char *name); 69 88 70 89 // look for the given argname on the argument list. find the give filename from the file rules … … 72 91 // Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only 73 92 // reference count is held by the config->files metadata. 74 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, char *filename, char *argname, int entry); 93 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, const char *filename, 94 const char *argname, int entry); 95 75 96 # endif -
trunk/psModules/src/camera/pmFPAfileIO.c
r10827 r10966 465 465 466 466 // do we need to write this file? 467 if (level != file->dataLevel) { 467 if ((file->mosaicLevel == PM_FPA_LEVEL_NONE && level != file->dataLevel) || // No mosaicking happening 468 (file->mosaicLevel != PM_FPA_LEVEL_NONE && level != file->mosaicLevel)) { // Mosaicking happening 468 469 psTrace("psModules.camera", 6, "skip writing of %s at this level %s: dataLevel is %s", 469 470 file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel)); … … 472 473 473 474 // do we need to open this file? 474 if (level >= file->fileLevel) { 475 if (level >= file->fileLevel && 476 (file->mosaicLevel == PM_FPA_LEVEL_NONE || 477 (file->mosaicLevel != PM_FPA_LEVEL_NONE && level >= file->mosaicLevel))) { 475 478 if (!pmFPAfileOpen (file, view, config)) { 476 479 psError(PS_ERR_IO, false, "failed to open %s", file->filename); … … 540 543 541 544 // create the data elements (headers, images) appropriate for this view 542 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view )545 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view, const pmConfig *config) 543 546 { 544 547 PS_ASSERT_PTR_NON_NULL(file, false); … … 571 574 572 575 // do we need to write this file? 573 if (level != file->fileLevel ) {576 if (level != file->fileLevel || file->mosaicLevel != PM_FPA_LEVEL_NONE) { 574 577 psTrace("psModules.camera", 6, "skip creation of %s at this level %s: fileLevel is %s", 575 578 file->name, pmFPALevelToName(level), pmFPALevelToName(file->fileLevel)); … … 581 584 case PM_FPA_FILE_MASK: 582 585 case PM_FPA_FILE_WEIGHT: 583 case PM_FPA_FILE_FRINGE: 584 // create FPA structure component based on view 585 pmFPAAddSourceFromView (file->fpa, view, file->format); 586 psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa); 587 break; 588 586 case PM_FPA_FILE_FRINGE: { 587 // create FPA structure component based on view 588 #if 0 589 psMetadata *format = file->format; // Camera format configuration 590 if (!format) { 591 // It's likely a mosaic, for which we don't yet know the appropriate format 592 const psMetadata *camera = file->fpa->camera; // Camera configuration 593 psMetadata *formats = psMetadataLookupMetadata(NULL, camera, "FORMATS"); // The FORMATS 594 if (!formats) { 595 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find FORMATS in camera configuration.\n"); 596 return false; 597 } 598 format = psMetadataLookupMetadata(NULL, formats, config->formatName); 599 if (!format) { 600 psError(PS_ERR_UNEXPECTED_NULL, false, 601 "Unable to find format %s in camera configuration.\n", config->formatName); 602 return false; 603 } 604 file->format = psMemIncrRefCounter(format); 605 } 606 #endif 607 pmFPAAddSourceFromView (file->fpa, view, file->format); 608 psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa); 609 break; 610 } 589 611 case PM_FPA_FILE_SX: 590 612 case PM_FPA_FILE_RAW: … … 727 749 goto failure; 728 750 } 729 if (!pmFPAfileCreate(file, view )) {751 if (!pmFPAfileCreate(file, view, config)) { 730 752 psError(PS_ERR_IO, false, "failed CREATE in FPA_BEFORE block for %s", file->name); 731 753 goto failure; -
trunk/psModules/src/camera/pmFPAfileIO.h
r7589 r10966 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 200 6-06-17 01:50:43$9 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-01-08 22:30:21 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 22 22 bool pmFPAfileRead (pmFPAfile *file, const pmFPAview *view, pmConfig *config); 23 23 24 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view );24 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view, pmConfig *config); 25 25 26 26 // write to the real file corresponding to the given pmFPAfile for the current view
Note:
See TracChangeset
for help on using the changeset viewer.
