Commits
Kazuhiko Shimada authored 1142e4207ba
1298 1298 | |
1299 1299 | Returns: |
1300 1300 | int: width of a slice. note that the minimum value is 0. |
1301 1301 | """ |
1302 1302 | # adjust index of both side within channel |
1303 1303 | # candidate slice width based on the feature line width |
1304 1304 | _candidate_width = ceil(max(line_width / self.NUM_CHANNELMAP, 1)) |
1305 1305 | # allowed max slice width based on the feature line center |
1306 1306 | _allowed_max_width = max(floor(2.0 * min(line_center + 0.5, self.nchan - line_center - 0.5) / self.NUM_CHANNELMAP), 1) |
1307 1307 | |
1308 - | # If both side of the vertical red lines is within nchan, then returns the candidate slice width |
1308 + | # If both sides of the vertical red lines are within nchan, then returns the candidate slice width |
1309 1309 | if line_center - _candidate_width * self.NUM_CHANNELMAP * 0.5 >= -0.5 and \ |
1310 1310 | line_center + _candidate_width * self.NUM_CHANNELMAP * 0.5 <= self.nchan - 1 + 0.5: |
1311 1311 | return _candidate_width |
1312 1312 | else: |
1313 1313 | # If one side of the lines is out of nchan, returns the allowed max slice width |
1314 1314 | return _allowed_max_width |
1315 1315 | |
1316 1316 | def calc_velocity_lines(self, is_leftside:bool, slice_width: int, idx_vertlines: List[int], velocity_line_center:float) -> List[float]: |
1317 1317 | """ |
1318 1318 | Calculate relative velocities for red vertical lines on the velocity plot using extrapolation. |