Esempio n. 1
0
 def increaseSelectionStartPointTime(self):
     # TODO: Move method to _penDataTimeLineWidget
     xmin, xmax = self.project.selectedtimeregion.getRegion()
     ix_bounds = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(xmin, xmax)
     if len(ix_bounds)>0:
         min_ix, max_ix = ix_bounds
         if np.all(self.project.nonzero_pressure_mask[min_ix:max_ix]):
             self.project.selectedtimeregion.setRegion(self.project.pendata['time'][[min_ix, max_ix]])
             return
         start_ixs,stop_ixs,lengths=self.project.nonzero_region_ix
         higher_starts=start_ixs[start_ixs>(min_ix)]
         if len(higher_starts)==0:
             infoDlg(title=u"Action Aborted", prompt=u"The start time of the selected time period can not be increased<br> any further; it is the last IPS run of the file.")
         elif higher_starts[0]>=max_ix-1:
             infoDlg(title=u"Action Aborted", prompt=u"The start time of the selected time period can not be further increased<br> without it exceeding the selected periods end time.")
         else:
             segmenttimeperiod = self.project.pendata['time'][[higher_starts[0], max_ix]]
             self.project.selectedtimeregion.setRegion(segmenttimeperiod)
Esempio n. 2
0
 def decreaseSelectionEndPointTime(self):
     # TODO: Move method to _penDataTimeLineWidget
     xmin, xmax = self.project.selectedtimeregion.getRegion()
     ix_bounds = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(xmin, xmax)
     if len(ix_bounds)>0:
         min_ix, max_ix = ix_bounds
         if np.all(self.project.nonzero_pressure_mask[min_ix:max_ix]):
             self.project.selectedtimeregion.setRegion(self.project.pendata['time'][[min_ix, max_ix]])
             return
         start_ixs, stop_ixs, lengths=self.project.nonzero_region_ix
         prev_maxs = stop_ixs[stop_ixs<max_ix]
         if prev_maxs.shape[0]>0:
             if prev_maxs[-1] > min_ix:
                 prev_max_ix = prev_maxs[-1]
                 segmenttimeperiod = self.project.pendata['time'][[min_ix, prev_max_ix]]
                 min_ix, max_ix = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(*segmenttimeperiod)
                 self.project.selectedtimeregion.setRegion(self.project.pendata['time'][[min_ix, max_ix]])
             else:
                 infoDlg(title=u"Action Aborted", prompt=u"The end time of the selected time period can not be decreased further<br>without it being equal to the selected periods start time.")
Esempio n. 3
0
 def increaseSelectionEndPointTime(self):
     # TODO: Move method to _penDataTimeLineWidget
     xmin, xmax = self.project.selectedtimeregion.getRegion()
     ix_bounds = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(xmin, xmax)
     if len(ix_bounds)>0:
         min_ix, max_ix = ix_bounds
         start_ixs,stop_ixs,lengths=self.project.nonzero_region_ix
         next_max_ix = stop_ixs[stop_ixs>(max_ix+1)][0]
         #print "org_max_ix, new_max_ix",max_ix,next_max_ix
         #print 'new start , end samples: ',self.project.pendata[[min_ix, next_max_ix]]
         if next_max_ix < self.project.pendata.shape[0]:
             segmenttimeperiod = self.project.pendata['time'][[min_ix, next_max_ix]]
             min_ix, next_max_ix = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(*segmenttimeperiod)
             self.project.selectedtimeregion.setRegion(self.project.pendata['time'][[min_ix, next_max_ix]])
             _,nxmax=segmenttimeperiod
             (vmin,vmax),(_,_)=self._penDataTimeLineWidget.getPlotItem().getViewBox().viewRange()
             if nxmax >= vmax:
                 self._penDataTimeLineWidget.getPlotItem().getViewBox().translateBy(x=(nxmax-vmax)*1.25)
         else:
              infoDlg(title=u"Action Aborted", prompt=u"The selected time period can not be extended<br>as it is at the end of the data samples.")
Esempio n. 4
0
    def jumpTimeSelectionForward(self):
        # TODO: Move method to _penDataTimeLineWidget
        xmin, xmax = self.project.selectedtimeregion.getRegion()
        pendata_ix_range = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(xmin, xmax)
        if len(pendata_ix_range):
            nix_min = pendata_ix_range[1]+1
            if self.project.pendata['pressure'][nix_min]==0.0:
                start_ixs,stop_ixs,lengths=self.project.nonzero_region_ix
                next_starts = start_ixs[start_ixs>nix_min]
                if len(next_starts)>0:
                    nix_min=next_starts[0]
                else:
                    infoDlg(title=u"Action Aborted", prompt=u"The selected time period can not be moved forward.<br>Reason: NTs index not available.")
                    return
            nxmin = self.project.pendata['time'][nix_min]
            nxmax = min(nxmin +(xmax-xmin), self.project.pendata['time'][-1])
            if nxmin >= nxmax:
                infoDlg(title=u"Action Aborted", prompt=u"The selected time period can not be moved forward.<br>Reason: End of data reached.")
                return
            self.project.selectedtimeregion.setRegion([nxmin,nxmax])

            (vmin,vmax),(_,_)=self._penDataTimeLineWidget.getPlotItem().getViewBox().viewRange()
            if nxmax >= vmax:
                self._penDataTimeLineWidget.getPlotItem().getViewBox().translateBy(x=(nxmax-vmax)*1.25)
Esempio n. 5
0
    def jumpTimeSelectionBackward(self):
        # TODO: Move method to _penDataTimeLineWidget
        if 0:
            xmin, xmax = self.project.selectedtimeregion.getRegion()
            nxmax =xmin-0.001
            nxmin = max(nxmax-(xmax-xmin),0.0)
            pendata_ix_range = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(nxmin,nxmax)
            if len(pendata_ix_range):
                segmenttimeperiod = self.project.pendata['time'][pendata_ix_range]
                self.project.selectedtimeregion.setRegion(segmenttimeperiod)

                (vmin,vmax),(_,_)=self._penDataTimeLineWidget.getPlotItem().getViewBox().viewRange()
                if nxmin < vmin:
                    self._penDataTimeLineWidget.getPlotItem().getViewBox().translateBy(x=(nxmin-vmin)*1.25)
        else:
            xmin, xmax = self.project.selectedtimeregion.getRegion()
            pendata_ix_range = self.project.segmentset.calculateTrimmedSegmentIndexBoundsFromTimeRange(xmin, xmax)
            if len(pendata_ix_range):
                nix_max = pendata_ix_range[0]-1
                if nix_max<=0:
                    infoDlg(title=u"Action Aborted", prompt=u"The selected time period can not be moved backward.<br>Reason: NTe index out of bounds.")
                    return
                if self.project.pendata['pressure'][nix_max]==0.0:
                    start_ixs,stop_ixs,lengths=self.project.nonzero_region_ix
                    prev_stops = stop_ixs[stop_ixs<=nix_max]
                    if len(prev_stops)>0:
                        nix_max=prev_stops[-1]
                    else:
                        infoDlg(title=u"Action Aborted", prompt=u"The selected time period can not be moved backward.<br>Reason: NTe index not available.")
                        return
                nxmax = self.project.pendata['time'][nix_max]
                nxmin = max(nxmax -(xmax-xmin), 0.0)
                if nxmin >= nxmax:
                    infoDlg(title=u"Action Aborted", prompt=u"The selected time period can not be moved backward.<br>Reason: End of data reached.")
                    return
                self.project.selectedtimeregion.setRegion([nxmin,nxmax])

                (vmin,vmax),(_,_)=self._penDataTimeLineWidget.getPlotItem().getViewBox().viewRange()
                if nxmin <= vmin:
                    self._penDataTimeLineWidget.getPlotItem().getViewBox().translateBy(x=(nxmin-vmin)*1.25)