choosehappy / HistoQC

HistoQC is an open-source quality control tool for digital pathology slides
BSD 3-Clause Clear License
253 stars 100 forks source link

checking if array equals an empty string during deconvolution #271

Closed jacksonjacobs1 closed 7 months ago

jacksonjacobs1 commented 7 months ago

https://github.com/choosehappy/HistoQC/blob/d29c63c8de01490816bdeeb3ffbaa0920ce6c875/histoqc/DeconvolutionModule.py#L28

This line raises the following ValueError when stain_matrix is an array:

Exception has occurred: ValueError
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Change this line:

    stain_matrix = getattr(sys.modules[__name__], stain, "")

    if stain_matrix == "":

to check the truthy value instead:

    stain_matrix = getattr(sys.modules[__name__], stain, None)

    if stain_matrix:
jacksonjacobs1 commented 7 months ago

This issue was resolved in #272