EMIP-Toolkit icon indicating copy to clipboard operation
EMIP-Toolkit copied to clipboard

add_tokens_to_AOIs does not work when AOI kind is line instead of sub-line

Open nalmadi opened this issue 4 years ago • 4 comments

the function add_tokens_to_AOIs does not work when AOI kind is set to "line" it only works when kind is set to "sub-line"

nalmadi avatar Aug 25 '21 07:08 nalmadi

Hi, we are Elliot and Tom, and we are dealing with this issue. During the process of fixing the bug, we met some problems. First, we actually found that the bug is not actually a bug, and this method is designed only for sub-line kind AOI by using this line of code.aois_raw = aois_raw[aois_raw.kind == "sub-line"].copy() This makes the rest method including add_srcml_to_AOIs and hit_test to be unavailable for line kind AOI. Thus, our solution based on this assumption is adding an error message.

   if aois_raw.kind[0] == "line":
        msg = rf"cannot add a token when AOI kind is line"
        raise TypeError(msg)

However, we want to confirm with you about our assumption because we believe that there should be more use for the line kind AOI. Thank you for answering our concern.

mzhou23 avatar Dec 18 '21 06:12 mzhou23

Hello Elliot and Tom, Adding an error message is not a solution for the problem, it requires adding code to allow for an entire line to be processed as an area of interest. Start with the Jupyter notebook example and try to run it with a line to see how it fails. Ideally, we want this to work in a similar way to "part"

I responded to your email too. Let me know if you have any questions.

nalmadi avatar Dec 18 '21 18:12 nalmadi

Fixed! Reapply at 1444

aois_raw = aois_raw[aois_raw.kind == "sub-line"  or "line"].copy()

jhimel22 avatar Jan 01 '22 01:01 jhimel22

Thanks @jhimel22 You should create a pull request for this fix, if possible.

nalmadi avatar Jan 01 '22 04:01 nalmadi