public static double sourceTime2targetTime(double sourceTime, Labels sourceLabels, Labels targetLabels, int[][] map) { int sourceLabInd = SignalProcUtils.time2LabelIndex(sourceTime, sourceLabels); double sourceDuration, targetDuration; double locationInLabelPercent; if (sourceLabInd > 0) { sourceDuration = sourceLabels.items[sourceLabInd].time - sourceLabels.items[sourceLabInd - 1].time; locationInLabelPercent = (sourceTime - sourceLabels.items[sourceLabInd - 1].time) / sourceDuration; } else { sourceDuration = sourceLabels.items[sourceLabInd].time; locationInLabelPercent = sourceTime / sourceLabels.items[sourceLabInd].time; } int targetLabInd = StringUtils.findInMap(map, sourceLabInd); if (targetLabInd > 0) targetDuration = targetLabels.items[targetLabInd].time - targetLabels.items[targetLabInd - 1].time; else targetDuration = targetLabels.items[targetLabInd].time; double targetTime; if (targetLabInd > 0) targetTime = targetLabels.items[targetLabInd - 1].time + locationInLabelPercent * targetDuration; else targetTime = locationInLabelPercent * targetDuration; return targetTime; }
tSource = i * srcSkipSizeInSeconds + 0.5 * srcWindowSizeInSeconds; sourceLabInd = SignalProcUtils.time2LabelIndex(tSource, srcLabs); targetLabInd = StringUtils.findInMap(mappedLabelInds, sourceLabInd);
public static double sourceTime2targetTime(double sourceTime, Labels sourceLabels, Labels targetLabels, int[][] map) { int sourceLabInd = SignalProcUtils.time2LabelIndex(sourceTime, sourceLabels); double sourceDuration, targetDuration; double locationInLabelPercent; if (sourceLabInd > 0) { sourceDuration = sourceLabels.items[sourceLabInd].time - sourceLabels.items[sourceLabInd - 1].time; locationInLabelPercent = (sourceTime - sourceLabels.items[sourceLabInd - 1].time) / sourceDuration; } else { sourceDuration = sourceLabels.items[sourceLabInd].time; locationInLabelPercent = sourceTime / sourceLabels.items[sourceLabInd].time; } int targetLabInd = StringUtils.findInMap(map, sourceLabInd); if (targetLabInd > 0) targetDuration = targetLabels.items[targetLabInd].time - targetLabels.items[targetLabInd - 1].time; else targetDuration = targetLabels.items[targetLabInd].time; double targetTime; if (targetLabInd > 0) targetTime = targetLabels.items[targetLabInd - 1].time + locationInLabelPercent * targetDuration; else targetTime = locationInLabelPercent * targetDuration; return targetTime; }
tSource = i * srcSkipSizeInSeconds + 0.5 * srcWindowSizeInSeconds; sourceLabInd = SignalProcUtils.time2LabelIndex(tSource, srcLabs); targetLabInd = StringUtils.findInMap(mappedLabelInds, sourceLabInd);
labInd2 = StringUtils.findInMap(labelMap, labInd1);
labInd2 = StringUtils.findInMap(labelMap, labInd1);
tgtLabInd = StringUtils.findInMap(labelMap, srcLabInd);
tgtLabInd = StringUtils.findInMap(labelMap, srcLabInd);
tgtLabInd = StringUtils.findInMap(labelMap, srcLabInd);
tgtLabInd = StringUtils.findInMap(labelMap, srcLabInd);
srcStartTime = 0.0; tgtLabInd = StringUtils.findInMap(labelMap, j);
srcStartTime = 0.0; tgtLabInd = StringUtils.findInMap(labelMap, j);
targetDurationLabInd = StringUtils.findInMap(durationMap, sourceLabInd); if (targetDurationLabInd > 0) targetDuration = targetDurationLabels.items[targetDurationLabInd].time sourceDuration = sourceLabels.items[i].time; targetDurationLabInd = StringUtils.findInMap(durationMap, i); if (targetDurationLabInd > 0) targetDuration = targetDurationLabels.items[targetDurationLabInd].time
targetDurationLabInd = StringUtils.findInMap(durationMap, sourceLabInd); if (targetDurationLabInd > 0) targetDuration = targetDurationLabels.items[targetDurationLabInd].time sourceDuration = sourceLabels.items[i].time; targetDurationLabInd = StringUtils.findInMap(durationMap, i); if (targetDurationLabInd > 0) targetDuration = targetDurationLabels.items[targetDurationLabInd].time
srcStartTime = 0.0; tgtLabInd = StringUtils.findInMap(labelMap, j);
srcStartTime = 0.0; tgtLabInd = StringUtils.findInMap(labelMap, j);