나는 윤곽선의 주위와 영역을 얻으려고 노력해왔다. (솔리드/하이브리드 로켓 모터의 단점을 모델링하기 위해 레벨 설정 방법을 사용하고있다.) 여기 윤곽선 경로 가끔 비움
matplotlib - extracting values from contour lines
오류 재현 최소한의 예입니다 : 내가 여기 시스템 권장 접근 방식을 촬영했습니다import numpy as np
import pylab as pl
import skfmm
n_pts = 1000
r_f = 98 #mm (final radius)
fin_l = 20 #mm (fin length)
fin_w = 10 #mm (fin length)
#set up grid
X, Y = np.meshgrid(np.linspace(-r_f,r_f,n_pts), np.linspace(-r_f,r_f,n_pts))
initial_grid = -1 * np.ones_like(X)
#set up initial shape
initial_grid[np.logical_and(np.abs(Y) < fin_l, np.abs(X) < fin_w/2.)] = 1
initial_grid[np.logical_and(np.abs(Y) < fin_w/2., np.abs(X) < fin_l)] = 1
#obtain 3D Array
contour_grid = skfmm.distance(initial_grid, dx=1e-2)
perims = np.array([])
webs = np.linspace(0, r_f, n_pts/10)
for web in webs:
web_ctr = pl.contour(X, Y, contour_grid, [web])
no_error_here = p = web_ctr.collections[0].get_paths()
out_of_range_error = web_ctr.collections[0].get_paths()[0]
내가 오류 "범위를 벗어 목록 지수"는 얻을, 그리고 그것은 밝혀 그 no_error_here
빈 목록입니다. 나는 조금 둘러 보았고, matplotlib가 이것을하는 이유를 발견 할 수 없다. 팁?
이것은 확실히 많은 청소기,하지만 당신이 그래서 그것은 skimage.measure.find_contours'가 linspace''에 의해 이전에 정의 된 그리드를 사용하는 옵션이없는 '것을 주목할 필요가 자신을 변형 시키십시오. –