|
| 1 | +""" |
| 2 | +TODO: add default directory so when an f06 is bad, you don't |
| 3 | + have to keep changing the directory |
| 4 | +""" |
1 | 5 | import os |
2 | 6 | import sys |
3 | 7 | import copy |
|
63 | 67 |
|
64 | 68 | # FONT_SIZE = 12 |
65 | 69 | from pyNastran.f06.dev.flutter.utils import ( |
| 70 | + get_point_removal_str, |
| 71 | + point_removal_str_to_point_removal, |
66 | 72 | get_plot_file, update_ylog_style, load_f06_op2, |
67 | 73 | get_png_filename,) |
68 | 74 |
|
@@ -2219,63 +2225,6 @@ def log_error(self, msg: str) -> None: |
2219 | 2225 | print(f'ERROR: {msg}') |
2220 | 2226 |
|
2221 | 2227 |
|
2222 | | -def get_point_removal_str(point_removal: list[tuple[float, float]]): |
2223 | | - """ |
2224 | | - >>> point_removal = [[400.0, 410.0], [450.0, 500.0]] |
2225 | | - point_removal_str = get_point_removal_str(point_removal) |
2226 | | - >>> point_removal_str |
2227 | | - '400:410,450:500' |
2228 | | -
|
2229 | | - >>> point_removal = [[450.0, -1.0]] |
2230 | | - point_removal_str = get_point_removal_str(point_removal) |
2231 | | - >>> point_removal_str |
2232 | | - '450:' |
2233 | | -
|
2234 | | - >>> point_removal = [[-1.0, 500.0]] |
2235 | | - point_removal_str = get_point_removal_str(point_removal) |
2236 | | - >>> point_removal_str |
2237 | | - ':500' |
2238 | | - """ |
2239 | | - out = [] |
2240 | | - for mini, maxi in point_removal: |
2241 | | - if mini > 0 and maxi > 0: |
2242 | | - outi = f'{mini:g}:{maxi:g}' |
2243 | | - elif mini > 0: |
2244 | | - outi = f'{mini:g}:' |
2245 | | - elif maxi > 0: |
2246 | | - outi = f'{maxi:g}:' |
2247 | | - else: |
2248 | | - continue |
2249 | | - out.append(outi) |
2250 | | - point_removal_str = ','.join(out) |
2251 | | - return point_removal_str |
2252 | | - |
2253 | | - |
2254 | | -def point_removal_str_to_point_removal(point_removal_str: str, |
2255 | | - log: SimpleLogger) -> list[tuple[float, float]]: |
2256 | | - point_removal = [] |
2257 | | - point_removal_list = point_removal_str.split(',') |
2258 | | - |
2259 | | - if point_removal_list == ['']: |
2260 | | - pass |
2261 | | - else: |
2262 | | - try: |
2263 | | - for ipoint, point in enumerate(point_removal_list): |
2264 | | - sline = point.split(':') |
2265 | | - assert len(sline) == 2, f'point_removal[{ipoint}]={sline}; point_removal={str(point_removal_list)}' |
2266 | | - a_str = sline[0].strip() |
2267 | | - b_str = sline[1].strip() |
2268 | | - a = float(a_str) if a_str != '' else -1.0 |
2269 | | - b = float(b_str) if b_str != '' else -1.0 |
2270 | | - point_float = (a, b) |
2271 | | - point_removal.append(point_float) |
2272 | | - except Exception as e: |
2273 | | - log.error(str(e)) |
2274 | | - # print(traceback.print_tb(e)) |
2275 | | - print(traceback.print_exception(e)) |
2276 | | - return point_removal |
2277 | | - |
2278 | | - |
2279 | 2228 | def get_selected_items_flat(list_widget: QListWidget) -> list[str]: |
2280 | 2229 | items = list_widget.selectedItems() |
2281 | 2230 | texts = [] |
|
0 commit comments