小编dot*_*ear的帖子

为什么即使我外包给工作线程,我的GUI也没有响应?

我有一个PyQt4 GUI,我需要将一堆Numpy数组保存为*.tif图像.这似乎需要花费大量时间并导致我的GUI无法响应长达几分钟,具体取决于堆栈中的图像数量.

大部分处理发生在图像循环中:

for i in range(0, np.shape(dataStack)[2]):

        print('Saving slice ' + str(i + 1))

        #Save tumor stack
        im1 = Image.fromarray(tumorStack[:,:,i]*255)
        im1.save(saveLocationStr + 'Slice' + str(i+1) + '.tif')

        #Set up correct number of subplots for review plot.
        if T0 is not None:
            plt.subplot(141)
        else:
            plt.subplot(131)

        #Plot current brain slice in 1st position
        plt.imshow(dataStack[:,:,i], cmap=mpl.cm.bone)
        plt.axis('off')

        plt.title(patient + '\n' + date + '\n' + 'Slice ' + str(i+1) + ' of ' + str(int(np.shape(dataStack)[2])))

        #Select correct next subplot
        if T0 is …
Run Code Online (Sandbox Code Playgroud)

python multithreading pyqt4

6
推荐指数
1
解决办法
654
查看次数

我可以根据 Elasticsearch 聚合中的查询更改结果分数吗?

我正在使用带有嵌套 top_hits 聚合的 Elasticsearch 过滤器聚合来检索基于不同过滤器的最匹配文档,但我似乎无法通过 boosting 或嵌套的 function_score 查询更改每个存储桶中的结果分数。这是不可能的吗?我没有找到任何明确的文档说它不起作用,并且查询执行得很好,但是结果分数不受影响。

示例查询(注意第一次聚合中的巨大提升):

GET _search
{  
   "size":0,
   "query":{  
      "bool":{  
         "should":[  
            {  
               "multi_match":{  
                  "type":"phrase",
                  "query":"TV",
                  "fields":[  
                     "categories^4"
                  ]
               }
            }
         ]
      }
   },
   "aggs":{  
      "1":{  
         "filter":{  
            "bool":{  
               "must":[  
                  {  
                     "multi_match":{  
                        "type":"phrase",
                        "query":"Music",
                        "fields":[  
                           "categories^10"
                        ]
                     }
                  }
               ]
            }
         },
         "aggs":{  
            "1_hits":{  
               "top_hits":{  
                  "size":10,
                  "sort":[  
                     {  
                        "_score":{  
                           "order":"desc"
                        }
                     }
                  ]
               }
            }
         }
      },
      "2":{  
         "filter":{  
            "bool":{  
               "must":[  
                  {  
                     "multi_match":{  
                        "type":"phrase",
                        "query":"Music",
                        "fields":[  
                           "categories"
                        ]
                     }
                  }
               ]
            }
         },
         "aggs":{  
            "2_hits":{  
               "top_hits":{ …
Run Code Online (Sandbox Code Playgroud)

elasticsearch nest kibana

5
推荐指数
0
解决办法
70
查看次数

标签 统计

elasticsearch ×1

kibana ×1

multithreading ×1

nest ×1

pyqt4 ×1

python ×1