Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python][ArborGUI] Certain locset expressions generate errors #1229

Closed
brenthuisman opened this issue Nov 12, 2020 · 9 comments
Closed

[Python][ArborGUI] Certain locset expressions generate errors #1229

brenthuisman opened this issue Nov 12, 2020 · 9 comments

Comments

@brenthuisman
Copy link
Contributor

Describe the bug

Not all locset expressions seem to be working. Take this Python script:

import arbor as arb

labels = arb.label_dict({'soma': '(tag 1)', 'axon': '(tag 2)',
                         'dend': '(tag 3)', 'apic': '(tag 4)',
                         'center': '(location 0 0.5)',
                         })

labels['reg1']= '(radius-lt (region "dend") 0.5)'
labels['reg2']= '(radius-lt (tag 3) 0.5)'
labels['reg3']= '(radius-gt (all) 0.5)'
labels['reg4']= '(branch 2)'
labels['reg5']= '(distal (all))'
labels['reg6']= '(radius_lt (all) 0.5)'

It terminates with the following:

Traceback (most recent call last):
  File "model.py", line 13, in <module>
    labels['reg6']= '(radius_lt (all) 0.5)'
RuntimeError: 
----- internal error -------------------------------------------
Error parsing the label: 'reg6' = '(radius_lt (all) 0.5)'

error in label description at 1:2: No matches for 'radius_lt' with 2 arguments: (region real)
  There are 0 potential candiates..

Please file a bug report with this full error message at:
    github.com/arbor-sim/arbor/issues
----------------------------------------------------------------

Possibly related: arbor-gui, trips over even more expressions.

  • (radius-lt "dend" 0.5) produces:
[2020-11-12 13:17:23.984] [debug] called error  No matches for 'radius-lt' with 2 arguments: (unknown real)
  There are 1 potential candiates:
  Candidate 1  'radius-lt' with 2 arguments: (reg:region radius:real).!
  • (radius-lt (tag 3) 0.5) produces:
[2020-11-12 13:14:31.491] [debug] called error Invalid locset description: '(radius-lt (tag 3) 0.5)' is neither a valid locset expression or locset label string!
  • (branch 2) procudes:
[debug] called error Invalid locset description: '(branch 2)' is neither a valid locset expression or locset label string!

I've run the tests with the following addition:

    auto lt = reg::radius_lt(reg::tagged(3), 0.5);
    auto gt = reg::radius_gt(reg::tagged(3), 0.5);
    EXPECT_EQ(to_string(lt), "(radius-lt (tag 3) 0.5)");
    EXPECT_EQ(to_string(gt), "(radius-gt (tag 3) 0.5)");

which does not fail.

@bcumming
Copy link
Member

Here are the docs for radius-lt:
https://arbor.readthedocs.io/en/latest/concepts/labels.html#label-radius-lt-reg-region-radius-real

The first error is because of a typo: radius_lt, not radius-lt.

The second error is because "dend" is not a valid region expression.

Try (radius-lt (region "dend") 0.5).

@bcumming
Copy link
Member

error in label description at 1:2: No matches for 'radius_lt' with 2 arguments: (region real)
  There are 0 potential candiates..

This is saying that you called radius_lt with arguments of type region and real, and that there are zero versions of radius_lt (i.e. radius_lt is not a known region type).

No matches for 'radius-lt' with 2 arguments: (unknown real)
  There are 1 potential candiates:
  Candidate 1  'radius-lt' with 2 arguments: (reg:region radius:real).

Says that radius-lt is called with two arguments of type unknown and real, and there is one alternative that takes a region and a real. So you can infer that "dend" does not define a region.

@bcumming
Copy link
Member

Finally, (branch 2) defines a region, not a locset. The error says '(branch 2)' is neither a valid locset expression or locset label string, which is correct.

@brenthuisman
Copy link
Contributor Author

brenthuisman commented Nov 12, 2020

  1. Good catch! That solves it.
  2. I've tried (radius-lt (region "dend") 0.5) as well, it gives (in the gui):
[2020-11-12 16:31:14.365] [debug] called error Invalid locset description: '(radius-lt (region "dend") 0.5)' is neither a valid locset expression or locset label string!

The docs lead me to believe "a_valid_label" is a valid region, so if "dend" is defined, that should work, right? But, @thorstenhater mentioned he does not actually set up a label_dict, so that must the cause.
3. I see now that this was actually thought through :) Regions and (sets of) locations are different categories!

@bcumming
Copy link
Member

Indeed.
Text labels can be given to regions and locsets, and our little DSL requires that everything is typed, where the possible types are:

region, locset, string, real, int

@brenthuisman
Copy link
Contributor Author

The docs state that "soma" is a shortcut for the region "soma". What does shortcut mean then? Apparently it does not evaluate to a region.

@brenthuisman brenthuisman reopened this Nov 12, 2020
@thorstenhater
Copy link
Contributor

This works even w/o a label_dict
(radius-lt (region "rad") 0.5)

@brenthuisman
Copy link
Contributor Author

Not in the GUI however. I'm trying to write a correct test in the C++ tests (#1230) but there I run into another issue.

@thorstenhater
Copy link
Contributor

For reference: The issue in the GUI was unrelated, putting a region expression into a locset control and vice versa will return errors since the expressions are coerced to the respective type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants