Unverified Commit 3d92be73 authored by jayd1860's avatar jayd1860 Committed by GitHub
Browse files

Merge pull request #71 from BUNPC/edit-ProbeClass

Edit probe class
parents 9fb82e23 775f8b61
Loading
Loading
Loading
Loading
+32 −4
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@ classdef ProbeClass < FileLoadSaveClass
        sourcePos2D
        sourcePos2D
        detectorPos2D
        detectorPos2D
        landmarkPos2D
        landmarkPos2D
        landmarkPos3D
        sourcePos3D
        sourcePos3D
        detectorPos3D
        detectorPos3D
        frequencies
        frequencies
@@ -33,10 +34,33 @@ classdef ProbeClass < FileLoadSaveClass
                    SD = varargin{1};
                    SD = varargin{1};
                    obj.wavelengths = SD.Lambda;
                    obj.wavelengths = SD.Lambda;
                    obj.wavelengthsEmission  = [];
                    obj.wavelengthsEmission  = [];
                    if isfield(SD,'SrcPos2D') &  ~isempty(SD.SrcPos2D)
                        obj.sourcePos2D  = SD.SrcPos2D;
                    else
                        obj.sourcePos2D  = SD.SrcPos;
                        obj.sourcePos2D  = SD.SrcPos;
                    end
                    if isfield(SD,'DetPos2D') & ~isempty(SD.DetPos2D)
                        obj.detectorPos2D  = SD.DetPos2D;
                    else
                        obj.detectorPos2D  = SD.DetPos;
                        obj.detectorPos2D  = SD.DetPos;
                    end
                    if isfield(SD,'SrcPos3D') & ~isempty(SD.SrcPos3D)
                        obj.sourcePos3D  = SD.SrcPos3D;
                    else
                        obj.sourcePos3D  = SD.SrcPos;
                        obj.sourcePos3D  = SD.SrcPos;
                    end
                    if isfield(SD,'DetPos3D') & ~isempty(SD.DetPos3D)
                        obj.detectorPos3D  = SD.DetPos3D;
                    else
                        obj.detectorPos3D  = SD.DetPos;
                        obj.detectorPos3D  = SD.DetPos;
                    end
                    if isfield(SD,'refpts')
                        obj.landmarkPos3D = SD.refpts.pos;
                        obj.landmarkLabels = SD.refpts.labels;
                        if isfield(SD,'refpts2D')
                            obj.landmarkPos2D = SD.refpts2D.pos;
                        end
                    end
                    obj.frequencies  = 1;
                    obj.frequencies  = 1;
                    obj.timeDelays  = 0;
                    obj.timeDelays  = 0;
                    obj.timeDelayWidths  = 0;
                    obj.timeDelayWidths  = 0;
@@ -139,6 +163,7 @@ classdef ProbeClass < FileLoadSaveClass
                obj.landmarkPos2D             = HDF5_DatasetLoad(gid, 'landmarkPos2D', [], '2D');
                obj.landmarkPos2D             = HDF5_DatasetLoad(gid, 'landmarkPos2D', [], '2D');
                obj.sourcePos3D               = HDF5_DatasetLoad(gid, 'sourcePos3D', [], '3D');
                obj.sourcePos3D               = HDF5_DatasetLoad(gid, 'sourcePos3D', [], '3D');
                obj.detectorPos3D             = HDF5_DatasetLoad(gid, 'detectorPos3D', [], '3D');
                obj.detectorPos3D             = HDF5_DatasetLoad(gid, 'detectorPos3D', [], '3D');
                obj.landmarkPos3D             = HDF5_DatasetLoad(gid, 'landmarkPos3D', [], '2D');
                obj.frequencies               = HDF5_DatasetLoad(gid, 'frequencies');
                obj.frequencies               = HDF5_DatasetLoad(gid, 'frequencies');
                obj.timeDelays                 = HDF5_DatasetLoad(gid, 'timeDelays');
                obj.timeDelays                 = HDF5_DatasetLoad(gid, 'timeDelays');
                obj.timeDelayWidths            = HDF5_DatasetLoad(gid, 'timeDelayWidths');
                obj.timeDelayWidths            = HDF5_DatasetLoad(gid, 'timeDelayWidths');
@@ -204,8 +229,10 @@ classdef ProbeClass < FileLoadSaveClass
            hdf5write_safe(fileobj, [location, '/wavelengthsEmission'], obj.wavelengthsEmission);
            hdf5write_safe(fileobj, [location, '/wavelengthsEmission'], obj.wavelengthsEmission);
            hdf5write_safe(fileobj, [location, '/sourcePos2D'], obj.sourcePos2D(:,1:2), 'rw:2D');
            hdf5write_safe(fileobj, [location, '/sourcePos2D'], obj.sourcePos2D(:,1:2), 'rw:2D');
            hdf5write_safe(fileobj, [location, '/detectorPos2D'], obj.detectorPos2D(:,1:2), 'rw:2D');
            hdf5write_safe(fileobj, [location, '/detectorPos2D'], obj.detectorPos2D(:,1:2), 'rw:2D');
            hdf5write_safe(fileobj, [location, '/landmarkPos2D'], obj.landmarkPos2D, 'rw:2D');
            hdf5write_safe(fileobj, [location, '/sourcePos3D'], obj.sourcePos3D, 'rw:3D');
            hdf5write_safe(fileobj, [location, '/sourcePos3D'], obj.sourcePos3D, 'rw:3D');
            hdf5write_safe(fileobj, [location, '/detectorPos3D'], obj.detectorPos3D, 'rw:3D');
            hdf5write_safe(fileobj, [location, '/detectorPos3D'], obj.detectorPos3D, 'rw:3D');
            hdf5write_safe(fileobj, [location, '/landmarkPos3D'], obj.landmarkPos3D, 'rw:3D')
            hdf5write_safe(fileobj, [location, '/frequencies'], obj.frequencies);
            hdf5write_safe(fileobj, [location, '/frequencies'], obj.frequencies);
            hdf5write_safe(fileobj, [location, '/timeDelays'], obj.timeDelays);
            hdf5write_safe(fileobj, [location, '/timeDelays'], obj.timeDelays);
            hdf5write_safe(fileobj, [location, '/timeDelayWidths'], obj.timeDelayWidths);
            hdf5write_safe(fileobj, [location, '/timeDelayWidths'], obj.timeDelayWidths);
@@ -214,6 +241,7 @@ classdef ProbeClass < FileLoadSaveClass
            hdf5write_safe(fileobj, [location, '/correlationTimeDelayWidths'], obj.correlationTimeDelayWidths);
            hdf5write_safe(fileobj, [location, '/correlationTimeDelayWidths'], obj.correlationTimeDelayWidths);
            hdf5write_safe(fileobj, [location, '/sourceLabels'], obj.sourceLabels);
            hdf5write_safe(fileobj, [location, '/sourceLabels'], obj.sourceLabels);
            hdf5write_safe(fileobj, [location, '/detectorLabels'], obj.detectorLabels);
            hdf5write_safe(fileobj, [location, '/detectorLabels'], obj.detectorLabels);
            hdf5write_safe(fileobj, [location, '/landmarkLabels'], obj.landmarkLabels);
        end
        end