Created
May 15, 2015 18:47
-
-
Save jjhelmus/ff5ced43b1d0d1433efe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- Generated by Cython 0.21.2 --> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<style type="text/css"> | |
body.cython { font-family: courier; font-size: 12; } | |
.cython.tag { } | |
.cython.line { margin: 0em } | |
.cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 20px; } | |
.cython.code .py_c_api { color: red; } | |
.cython.code .py_macro_api { color: #FF7000; } | |
.cython.code .pyx_c_api { color: #FF3000; } | |
.cython.code .pyx_macro_api { color: #FF7000; } | |
.cython.code .refnanny { color: #FFA000; } | |
.cython.code .error_goto { color: #FFA000; } | |
.cython.code .coerce { color: #008000; border: 1px dotted #008000 } | |
.cython.code .py_attr { color: #FF0000; font-weight: bold; } | |
.cython.code .c_attr { color: #0000FF; } | |
.cython.code .py_call { color: #FF0000; font-weight: bold; } | |
.cython.code .c_call { color: #0000FF; } | |
.cython.score-0 {background-color: #FFFFff;} | |
.cython.score-1 {background-color: #FFFFe7;} | |
.cython.score-2 {background-color: #FFFFd4;} | |
.cython.score-3 {background-color: #FFFFc4;} | |
.cython.score-4 {background-color: #FFFFb6;} | |
.cython.score-5 {background-color: #FFFFaa;} | |
.cython.score-6 {background-color: #FFFF9f;} | |
.cython.score-7 {background-color: #FFFF96;} | |
.cython.score-8 {background-color: #FFFF8d;} | |
.cython.score-9 {background-color: #FFFF86;} | |
.cython.score-10 {background-color: #FFFF7f;} | |
.cython.score-11 {background-color: #FFFF79;} | |
.cython.score-12 {background-color: #FFFF73;} | |
.cython.score-13 {background-color: #FFFF6e;} | |
.cython.score-14 {background-color: #FFFF6a;} | |
.cython.score-15 {background-color: #FFFF66;} | |
.cython.score-16 {background-color: #FFFF62;} | |
.cython.score-17 {background-color: #FFFF5e;} | |
.cython.score-18 {background-color: #FFFF5b;} | |
.cython.score-19 {background-color: #FFFF57;} | |
.cython.score-20 {background-color: #FFFF55;} | |
.cython.score-21 {background-color: #FFFF52;} | |
.cython.score-22 {background-color: #FFFF4f;} | |
.cython.score-23 {background-color: #FFFF4d;} | |
.cython.score-24 {background-color: #FFFF4b;} | |
.cython.score-25 {background-color: #FFFF48;} | |
.cython.score-26 {background-color: #FFFF46;} | |
.cython.score-27 {background-color: #FFFF44;} | |
.cython.score-28 {background-color: #FFFF43;} | |
.cython.score-29 {background-color: #FFFF41;} | |
.cython.score-30 {background-color: #FFFF3f;} | |
.cython.score-31 {background-color: #FFFF3e;} | |
.cython.score-32 {background-color: #FFFF3c;} | |
.cython.score-33 {background-color: #FFFF3b;} | |
.cython.score-34 {background-color: #FFFF39;} | |
.cython.score-35 {background-color: #FFFF38;} | |
.cython.score-36 {background-color: #FFFF37;} | |
.cython.score-37 {background-color: #FFFF36;} | |
.cython.score-38 {background-color: #FFFF35;} | |
.cython.score-39 {background-color: #FFFF34;} | |
.cython.score-40 {background-color: #FFFF33;} | |
.cython.score-41 {background-color: #FFFF32;} | |
.cython.score-42 {background-color: #FFFF31;} | |
.cython.score-43 {background-color: #FFFF30;} | |
.cython.score-44 {background-color: #FFFF2f;} | |
.cython.score-45 {background-color: #FFFF2e;} | |
.cython.score-46 {background-color: #FFFF2d;} | |
.cython.score-47 {background-color: #FFFF2c;} | |
.cython.score-48 {background-color: #FFFF2b;} | |
.cython.score-49 {background-color: #FFFF2b;} | |
.cython.score-50 {background-color: #FFFF2a;} | |
.cython.score-51 {background-color: #FFFF29;} | |
.cython.score-52 {background-color: #FFFF29;} | |
.cython.score-53 {background-color: #FFFF28;} | |
.cython.score-54 {background-color: #FFFF27;} | |
.cython.score-55 {background-color: #FFFF27;} | |
.cython.score-56 {background-color: #FFFF26;} | |
.cython.score-57 {background-color: #FFFF26;} | |
.cython.score-58 {background-color: #FFFF25;} | |
.cython.score-59 {background-color: #FFFF24;} | |
.cython.score-60 {background-color: #FFFF24;} | |
.cython.score-61 {background-color: #FFFF23;} | |
.cython.score-62 {background-color: #FFFF23;} | |
.cython.score-63 {background-color: #FFFF22;} | |
.cython.score-64 {background-color: #FFFF22;} | |
.cython.score-65 {background-color: #FFFF22;} | |
.cython.score-66 {background-color: #FFFF21;} | |
.cython.score-67 {background-color: #FFFF21;} | |
.cython.score-68 {background-color: #FFFF20;} | |
.cython.score-69 {background-color: #FFFF20;} | |
.cython.score-70 {background-color: #FFFF1f;} | |
.cython.score-71 {background-color: #FFFF1f;} | |
.cython.score-72 {background-color: #FFFF1f;} | |
.cython.score-73 {background-color: #FFFF1e;} | |
.cython.score-74 {background-color: #FFFF1e;} | |
.cython.score-75 {background-color: #FFFF1e;} | |
.cython.score-76 {background-color: #FFFF1d;} | |
.cython.score-77 {background-color: #FFFF1d;} | |
.cython.score-78 {background-color: #FFFF1c;} | |
.cython.score-79 {background-color: #FFFF1c;} | |
.cython.score-80 {background-color: #FFFF1c;} | |
.cython.score-81 {background-color: #FFFF1c;} | |
.cython.score-82 {background-color: #FFFF1b;} | |
.cython.score-83 {background-color: #FFFF1b;} | |
.cython.score-84 {background-color: #FFFF1b;} | |
.cython.score-85 {background-color: #FFFF1a;} | |
.cython.score-86 {background-color: #FFFF1a;} | |
.cython.score-87 {background-color: #FFFF1a;} | |
.cython.score-88 {background-color: #FFFF1a;} | |
.cython.score-89 {background-color: #FFFF19;} | |
.cython.score-90 {background-color: #FFFF19;} | |
.cython.score-91 {background-color: #FFFF19;} | |
.cython.score-92 {background-color: #FFFF19;} | |
.cython.score-93 {background-color: #FFFF18;} | |
.cython.score-94 {background-color: #FFFF18;} | |
.cython.score-95 {background-color: #FFFF18;} | |
.cython.score-96 {background-color: #FFFF18;} | |
.cython.score-97 {background-color: #FFFF17;} | |
.cython.score-98 {background-color: #FFFF17;} | |
.cython.score-99 {background-color: #FFFF17;} | |
.cython.score-100 {background-color: #FFFF17;} | |
.cython.score-101 {background-color: #FFFF16;} | |
.cython.score-102 {background-color: #FFFF16;} | |
.cython.score-103 {background-color: #FFFF16;} | |
.cython.score-104 {background-color: #FFFF16;} | |
.cython.score-105 {background-color: #FFFF16;} | |
.cython.score-106 {background-color: #FFFF15;} | |
.cython.score-107 {background-color: #FFFF15;} | |
.cython.score-108 {background-color: #FFFF15;} | |
.cython.score-109 {background-color: #FFFF15;} | |
.cython.score-110 {background-color: #FFFF15;} | |
.cython.score-111 {background-color: #FFFF15;} | |
.cython.score-112 {background-color: #FFFF14;} | |
.cython.score-113 {background-color: #FFFF14;} | |
.cython.score-114 {background-color: #FFFF14;} | |
.cython.score-115 {background-color: #FFFF14;} | |
.cython.score-116 {background-color: #FFFF14;} | |
.cython.score-117 {background-color: #FFFF14;} | |
.cython.score-118 {background-color: #FFFF13;} | |
.cython.score-119 {background-color: #FFFF13;} | |
.cython.score-120 {background-color: #FFFF13;} | |
.cython.score-121 {background-color: #FFFF13;} | |
.cython.score-122 {background-color: #FFFF13;} | |
.cython.score-123 {background-color: #FFFF13;} | |
.cython.score-124 {background-color: #FFFF13;} | |
.cython.score-125 {background-color: #FFFF12;} | |
.cython.score-126 {background-color: #FFFF12;} | |
.cython.score-127 {background-color: #FFFF12;} | |
.cython.score-128 {background-color: #FFFF12;} | |
.cython.score-129 {background-color: #FFFF12;} | |
.cython.score-130 {background-color: #FFFF12;} | |
.cython.score-131 {background-color: #FFFF12;} | |
.cython.score-132 {background-color: #FFFF11;} | |
.cython.score-133 {background-color: #FFFF11;} | |
.cython.score-134 {background-color: #FFFF11;} | |
.cython.score-135 {background-color: #FFFF11;} | |
.cython.score-136 {background-color: #FFFF11;} | |
.cython.score-137 {background-color: #FFFF11;} | |
.cython.score-138 {background-color: #FFFF11;} | |
.cython.score-139 {background-color: #FFFF11;} | |
.cython.score-140 {background-color: #FFFF11;} | |
.cython.score-141 {background-color: #FFFF10;} | |
.cython.score-142 {background-color: #FFFF10;} | |
.cython.score-143 {background-color: #FFFF10;} | |
.cython.score-144 {background-color: #FFFF10;} | |
.cython.score-145 {background-color: #FFFF10;} | |
.cython.score-146 {background-color: #FFFF10;} | |
.cython.score-147 {background-color: #FFFF10;} | |
.cython.score-148 {background-color: #FFFF10;} | |
.cython.score-149 {background-color: #FFFF10;} | |
.cython.score-150 {background-color: #FFFF0f;} | |
.cython.score-151 {background-color: #FFFF0f;} | |
.cython.score-152 {background-color: #FFFF0f;} | |
.cython.score-153 {background-color: #FFFF0f;} | |
.cython.score-154 {background-color: #FFFF0f;} | |
.cython.score-155 {background-color: #FFFF0f;} | |
.cython.score-156 {background-color: #FFFF0f;} | |
.cython.score-157 {background-color: #FFFF0f;} | |
.cython.score-158 {background-color: #FFFF0f;} | |
.cython.score-159 {background-color: #FFFF0f;} | |
.cython.score-160 {background-color: #FFFF0f;} | |
.cython.score-161 {background-color: #FFFF0e;} | |
.cython.score-162 {background-color: #FFFF0e;} | |
.cython.score-163 {background-color: #FFFF0e;} | |
.cython.score-164 {background-color: #FFFF0e;} | |
.cython.score-165 {background-color: #FFFF0e;} | |
.cython.score-166 {background-color: #FFFF0e;} | |
.cython.score-167 {background-color: #FFFF0e;} | |
.cython.score-168 {background-color: #FFFF0e;} | |
.cython.score-169 {background-color: #FFFF0e;} | |
.cython.score-170 {background-color: #FFFF0e;} | |
.cython.score-171 {background-color: #FFFF0e;} | |
.cython.score-172 {background-color: #FFFF0e;} | |
.cython.score-173 {background-color: #FFFF0d;} | |
.cython.score-174 {background-color: #FFFF0d;} | |
.cython.score-175 {background-color: #FFFF0d;} | |
.cython.score-176 {background-color: #FFFF0d;} | |
.cython.score-177 {background-color: #FFFF0d;} | |
.cython.score-178 {background-color: #FFFF0d;} | |
.cython.score-179 {background-color: #FFFF0d;} | |
.cython.score-180 {background-color: #FFFF0d;} | |
.cython.score-181 {background-color: #FFFF0d;} | |
.cython.score-182 {background-color: #FFFF0d;} | |
.cython.score-183 {background-color: #FFFF0d;} | |
.cython.score-184 {background-color: #FFFF0d;} | |
.cython.score-185 {background-color: #FFFF0d;} | |
.cython.score-186 {background-color: #FFFF0d;} | |
.cython.score-187 {background-color: #FFFF0c;} | |
.cython.score-188 {background-color: #FFFF0c;} | |
.cython.score-189 {background-color: #FFFF0c;} | |
.cython.score-190 {background-color: #FFFF0c;} | |
.cython.score-191 {background-color: #FFFF0c;} | |
.cython.score-192 {background-color: #FFFF0c;} | |
.cython.score-193 {background-color: #FFFF0c;} | |
.cython.score-194 {background-color: #FFFF0c;} | |
.cython.score-195 {background-color: #FFFF0c;} | |
.cython.score-196 {background-color: #FFFF0c;} | |
.cython.score-197 {background-color: #FFFF0c;} | |
.cython.score-198 {background-color: #FFFF0c;} | |
.cython.score-199 {background-color: #FFFF0c;} | |
.cython.score-200 {background-color: #FFFF0c;} | |
.cython.score-201 {background-color: #FFFF0c;} | |
.cython.score-202 {background-color: #FFFF0c;} | |
.cython.score-203 {background-color: #FFFF0b;} | |
.cython.score-204 {background-color: #FFFF0b;} | |
.cython.score-205 {background-color: #FFFF0b;} | |
.cython.score-206 {background-color: #FFFF0b;} | |
.cython.score-207 {background-color: #FFFF0b;} | |
.cython.score-208 {background-color: #FFFF0b;} | |
.cython.score-209 {background-color: #FFFF0b;} | |
.cython.score-210 {background-color: #FFFF0b;} | |
.cython.score-211 {background-color: #FFFF0b;} | |
.cython.score-212 {background-color: #FFFF0b;} | |
.cython.score-213 {background-color: #FFFF0b;} | |
.cython.score-214 {background-color: #FFFF0b;} | |
.cython.score-215 {background-color: #FFFF0b;} | |
.cython.score-216 {background-color: #FFFF0b;} | |
.cython.score-217 {background-color: #FFFF0b;} | |
.cython.score-218 {background-color: #FFFF0b;} | |
.cython.score-219 {background-color: #FFFF0b;} | |
.cython.score-220 {background-color: #FFFF0b;} | |
.cython.score-221 {background-color: #FFFF0b;} | |
.cython.score-222 {background-color: #FFFF0a;} | |
.cython.score-223 {background-color: #FFFF0a;} | |
.cython.score-224 {background-color: #FFFF0a;} | |
.cython.score-225 {background-color: #FFFF0a;} | |
.cython.score-226 {background-color: #FFFF0a;} | |
.cython.score-227 {background-color: #FFFF0a;} | |
.cython.score-228 {background-color: #FFFF0a;} | |
.cython.score-229 {background-color: #FFFF0a;} | |
.cython.score-230 {background-color: #FFFF0a;} | |
.cython.score-231 {background-color: #FFFF0a;} | |
.cython.score-232 {background-color: #FFFF0a;} | |
.cython.score-233 {background-color: #FFFF0a;} | |
.cython.score-234 {background-color: #FFFF0a;} | |
.cython.score-235 {background-color: #FFFF0a;} | |
.cython.score-236 {background-color: #FFFF0a;} | |
.cython.score-237 {background-color: #FFFF0a;} | |
.cython.score-238 {background-color: #FFFF0a;} | |
.cython.score-239 {background-color: #FFFF0a;} | |
.cython.score-240 {background-color: #FFFF0a;} | |
.cython.score-241 {background-color: #FFFF0a;} | |
.cython.score-242 {background-color: #FFFF0a;} | |
.cython.score-243 {background-color: #FFFF0a;} | |
.cython.score-244 {background-color: #FFFF0a;} | |
.cython.score-245 {background-color: #FFFF0a;} | |
.cython.score-246 {background-color: #FFFF09;} | |
.cython.score-247 {background-color: #FFFF09;} | |
.cython.score-248 {background-color: #FFFF09;} | |
.cython.score-249 {background-color: #FFFF09;} | |
.cython.score-250 {background-color: #FFFF09;} | |
.cython.score-251 {background-color: #FFFF09;} | |
.cython.score-252 {background-color: #FFFF09;} | |
.cython.score-253 {background-color: #FFFF09;} | |
.cython.score-254 {background-color: #FFFF09;}.cython .hll { background-color: #ffffcc } | |
.cython { background: #f8f8f8; } | |
.cython .c { color: #408080; font-style: italic } /* Comment */ | |
.cython .err { border: 1px solid #FF0000 } /* Error */ | |
.cython .k { color: #008000; font-weight: bold } /* Keyword */ | |
.cython .o { color: #666666 } /* Operator */ | |
.cython .cm { color: #408080; font-style: italic } /* Comment.Multiline */ | |
.cython .cp { color: #BC7A00 } /* Comment.Preproc */ | |
.cython .c1 { color: #408080; font-style: italic } /* Comment.Single */ | |
.cython .cs { color: #408080; font-style: italic } /* Comment.Special */ | |
.cython .gd { color: #A00000 } /* Generic.Deleted */ | |
.cython .ge { font-style: italic } /* Generic.Emph */ | |
.cython .gr { color: #FF0000 } /* Generic.Error */ | |
.cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */ | |
.cython .gi { color: #00A000 } /* Generic.Inserted */ | |
.cython .go { color: #888888 } /* Generic.Output */ | |
.cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ | |
.cython .gs { font-weight: bold } /* Generic.Strong */ | |
.cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ | |
.cython .gt { color: #0044DD } /* Generic.Traceback */ | |
.cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ | |
.cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ | |
.cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ | |
.cython .kp { color: #008000 } /* Keyword.Pseudo */ | |
.cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ | |
.cython .kt { color: #B00040 } /* Keyword.Type */ | |
.cython .m { color: #666666 } /* Literal.Number */ | |
.cython .s { color: #BA2121 } /* Literal.String */ | |
.cython .na { color: #7D9029 } /* Name.Attribute */ | |
.cython .nb { color: #008000 } /* Name.Builtin */ | |
.cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */ | |
.cython .no { color: #880000 } /* Name.Constant */ | |
.cython .nd { color: #AA22FF } /* Name.Decorator */ | |
.cython .ni { color: #999999; font-weight: bold } /* Name.Entity */ | |
.cython .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ | |
.cython .nf { color: #0000FF } /* Name.Function */ | |
.cython .nl { color: #A0A000 } /* Name.Label */ | |
.cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ | |
.cython .nt { color: #008000; font-weight: bold } /* Name.Tag */ | |
.cython .nv { color: #19177C } /* Name.Variable */ | |
.cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ | |
.cython .w { color: #bbbbbb } /* Text.Whitespace */ | |
.cython .mb { color: #666666 } /* Literal.Number.Bin */ | |
.cython .mf { color: #666666 } /* Literal.Number.Float */ | |
.cython .mh { color: #666666 } /* Literal.Number.Hex */ | |
.cython .mi { color: #666666 } /* Literal.Number.Integer */ | |
.cython .mo { color: #666666 } /* Literal.Number.Oct */ | |
.cython .sb { color: #BA2121 } /* Literal.String.Backtick */ | |
.cython .sc { color: #BA2121 } /* Literal.String.Char */ | |
.cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ | |
.cython .s2 { color: #BA2121 } /* Literal.String.Double */ | |
.cython .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ | |
.cython .sh { color: #BA2121 } /* Literal.String.Heredoc */ | |
.cython .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ | |
.cython .sx { color: #008000 } /* Literal.String.Other */ | |
.cython .sr { color: #BB6688 } /* Literal.String.Regex */ | |
.cython .s1 { color: #BA2121 } /* Literal.String.Single */ | |
.cython .ss { color: #19177C } /* Literal.String.Symbol */ | |
.cython .bp { color: #008000 } /* Name.Builtin.Pseudo */ | |
.cython .vc { color: #19177C } /* Name.Variable.Class */ | |
.cython .vg { color: #19177C } /* Name.Variable.Global */ | |
.cython .vi { color: #19177C } /* Name.Variable.Instance */ | |
.cython .il { color: #666666 } /* Literal.Number.Integer.Long */ | |
</style> | |
<script> | |
function toggleDiv(id) { | |
theDiv = id.nextElementSibling | |
if (theDiv.style.display != 'block') theDiv.style.display = 'block'; | |
else theDiv.style.display = 'none'; | |
} | |
</script> | |
</head> | |
<body class="cython"> | |
<p>Generated by Cython 0.21.2</p> | |
<p>Raw output: <a href="_gate_to_grid_map.c">_gate_to_grid_map.c</a></p> | |
<div class="cython"><pre class='cython line score-11' onclick='toggleDiv(this)'>+001: <span class="sd">"""</span></pre> | |
<pre class='cython code score-11'> __pyx_t_1 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
</pre><pre class='cython line score-0'> 002: <span class="sd">pyart.map._gate_to_grid_map</span></pre> | |
<pre class='cython line score-0'> 003: <span class="sd">===========================</span></pre> | |
<pre class='cython line score-0'> 004: </pre> | |
<pre class='cython line score-0'> 005: <span class="sd">Cython classes and functions for efficient mapping of radar gates to</span></pre> | |
<pre class='cython line score-0'> 006: <span class="sd">a uniform grid.</span></pre> | |
<pre class='cython line score-0'> 007: </pre> | |
<pre class='cython line score-0'> 008: <span class="sd">.. autosummary::</span></pre> | |
<pre class='cython line score-0'> 009: <span class="sd"> :toctree: generated/</span></pre> | |
<pre class='cython line score-0'> 010: <span class="sd"> :template: dev_template.rst</span></pre> | |
<pre class='cython line score-0'> 011: </pre> | |
<pre class='cython line score-0'> 012: <span class="sd"> GateToGridMapper</span></pre> | |
<pre class='cython line score-0'> 013: <span class="sd"> RoIFunction</span></pre> | |
<pre class='cython line score-0'> 014: <span class="sd"> ConstantRoI</span></pre> | |
<pre class='cython line score-0'> 015: <span class="sd"> DistRoI</span></pre> | |
<pre class='cython line score-0'> 016: <span class="sd"> DistBeamRoI</span></pre> | |
<pre class='cython line score-0'> 017: </pre> | |
<pre class='cython line score-0'> 018: <span class="sd">"""</span></pre> | |
<pre class='cython line score-0'> 019: </pre> | |
<pre class='cython line score-0'> 020: <span class="k">from</span> <span class="nn">libc.math</span> <span class="k">cimport</span> <span class="n">sqrt</span><span class="p">,</span> <span class="n">exp</span><span class="p">,</span> <span class="n">ceil</span><span class="p">,</span> <span class="n">floor</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">cos</span><span class="p">,</span> <span class="n">tan</span><span class="p">,</span> <span class="n">asin</span><span class="p">,</span> <span class="n">isfinite</span></pre> | |
<pre class='cython line score-0'> 021: <span class="k">from</span> <span class="nn">cython.view</span> <span class="k">cimport</span> <span class="n">array</span> <span class="k">as</span> <span class="n">cvarray</span></pre> | |
<pre class='cython line score-0'> 022: </pre> | |
<pre class='cython line score-0'> 023: <span class="k">cimport</span> <span class="nn">cython</span></pre> | |
<pre class='cython line score-0'> 024: </pre> | |
<pre class='cython line score-0'> 025: <span class="c"># constants</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+026: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">BARNES</span> <span class="o">=</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_v_5pyart_3map_17_gate_to_grid_map_BARNES = 0; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+027: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">CRESSMAN</span> <span class="o">=</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_v_5pyart_3map_17_gate_to_grid_map_CRESSMAN = 0; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+028: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">PI</span> <span class="o">=</span> <span class="mf">3.141592653589793</span></pre> | |
<pre class='cython code score-0'> __pyx_v_5pyart_3map_17_gate_to_grid_map_PI = 3.141592653589793; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+029: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">R</span> <span class="o">=</span> <span class="mf">8494666.66666667</span> <span class="c"># 4/3 earths radius of 6371 km in meters</span></pre> | |
<pre class='cython code score-0'> __pyx_v_5pyart_3map_17_gate_to_grid_map_R = 8494666.66666667; | |
</pre><pre class='cython line score-0'> 030: </pre> | |
<pre class='cython line score-0'> 031: <span class="c"># This definition can be added to a .pxd file so others can defined fast</span></pre> | |
<pre class='cython line score-0'> 032: <span class="c"># RoI functions</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+033: <span class="k">cdef</span> <span class="k">class</span> <span class="nf">RoIFunction</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'>struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction { | |
PyObject_HEAD | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_vtab; | |
}; | |
/* … */ | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction { | |
float (*get_roi)(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *, float, float, float, int __pyx_skip_dispatch); | |
}; | |
static struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_vtabptr_5pyart_3map_17_gate_to_grid_map_RoIFunction; | |
</pre><pre class='cython line score-0'> 034: <span class="sd">""" A class for storing radius of interest calculations. """</span></pre> | |
<pre class='cython line score-0'> 035: </pre> | |
<pre class='cython line score-122' onclick='toggleDiv(this)'>+036: <span class="k">cpdef</span> <span class="kt">float</span> <span class="nf">get_roi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">float</span> <span class="n">z</span><span class="p">,</span> <span class="nb">float</span> <span class="n">y</span><span class="p">,</span> <span class="nb">float</span> <span class="n">x</span><span class="p">):</span></pre> | |
<pre class='cython code score-122'>static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11RoIFunction_1get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static float __pyx_f_5pyart_3map_17_gate_to_grid_map_11RoIFunction_get_roi(CYTHON_UNUSED struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_v_self, CYTHON_UNUSED float __pyx_v_z, CYTHON_UNUSED float __pyx_v_y, CYTHON_UNUSED float __pyx_v_x, int __pyx_skip_dispatch) { | |
float __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
/* Check if called by wrapper */ | |
if (unlikely(__pyx_skip_dispatch)) ; | |
/* Check if overridden in Python */ | |
else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { | |
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_get_roi);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5pyart_3map_17_gate_to_grid_map_11RoIFunction_1get_roi)) { | |
__pyx_t_3 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_z);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_4 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_y);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
__pyx_t_5 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_x);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
__pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL; | |
__pyx_t_8 = 0; | |
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_6))) { | |
__pyx_t_7 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_6); | |
if (likely(__pyx_t_7)) { | |
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function); | |
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_6, function); | |
__pyx_t_8 = 1; | |
} | |
} | |
__pyx_t_9 = <span class='py_c_api'>PyTuple_New</span>(3+__pyx_t_8);<span class='error_goto'> if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
if (__pyx_t_7) { | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0, __pyx_t_7); <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_7); __pyx_t_7 = NULL; | |
} | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_3); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_5); | |
__pyx_t_3 = 0; | |
__pyx_t_4 = 0; | |
__pyx_t_5 = 0; | |
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_6, __pyx_t_9, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0; | |
__pyx_t_10 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_2);<span class='error_goto'> if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
__pyx_r = __pyx_t_10; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
goto __pyx_L0; | |
} | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
} | |
/* … */ | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); | |
<span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("pyart.map._gate_to_grid_map.RoIFunction.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); | |
__pyx_r = 0; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
/* Python wrapper */ | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11RoIFunction_1get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_11RoIFunction_get_roi[] = " Return the radius of influence for coordinates in meters. "; | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11RoIFunction_1get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
float __pyx_v_z; | |
float __pyx_v_y; | |
float __pyx_v_x; | |
PyObject *__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_y,&__pyx_n_s_x,0}; | |
PyObject* values[3] = {0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_roi") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 3) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
} | |
__pyx_v_z = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[0]);<span class='error_goto'> if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_y = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[1]);<span class='error_goto'> if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_x = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[2]);<span class='error_goto'> if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.RoIFunction.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return NULL; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_11RoIFunction_get_roi(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *)__pyx_v_self), __pyx_v_z, __pyx_v_y, __pyx_v_x); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static PyObject *__pyx_pf_5pyart_3map_17_gate_to_grid_map_11RoIFunction_get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_v_self, float __pyx_v_z, float __pyx_v_y, float __pyx_v_x) { | |
PyObject *__pyx_r = NULL; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r); | |
__pyx_t_1 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_f_5pyart_3map_17_gate_to_grid_map_11RoIFunction_get_roi(__pyx_v_self, __pyx_v_z, __pyx_v_y, __pyx_v_x, 1));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_r = __pyx_t_1; | |
__pyx_t_1 = 0; | |
goto __pyx_L0; | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.RoIFunction.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = NULL; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 037: <span class="sd">""" Return the radius of influence for coordinates in meters. """</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+038: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0.0; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 039: </pre> | |
<pre class='cython line score-0'> 040: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+041: <span class="k">cdef</span> <span class="k">class</span> <span class="nf">ConstantRoI</span><span class="p">(</span><span class="n">RoIFunction</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'>struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_ConstantRoI { | |
struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction __pyx_base; | |
float constant_roi; | |
}; | |
/* … */ | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_ConstantRoI { | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction __pyx_base; | |
}; | |
static struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_ConstantRoI *__pyx_vtabptr_5pyart_3map_17_gate_to_grid_map_ConstantRoI; | |
</pre><pre class='cython line score-0'> 042: <span class="sd">""" Constant radius of influence class. """</span></pre> | |
<pre class='cython line score-0'> 043: </pre> | |
<pre class='cython line score-0'> 044: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">constant_roi</span></pre> | |
<pre class='cython line score-0'> 045: </pre> | |
<pre class='cython line score-26' onclick='toggleDiv(this)'>+046: <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">float</span> <span class="n">constant_roi</span><span class="p">):</span></pre> | |
<pre class='cython code score-26'>/* Python wrapper */ | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_11ConstantRoI___init__[] = " intialize. "; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
struct wrapperbase __pyx_wrapperbase_5pyart_3map_17_gate_to_grid_map_11ConstantRoI___init__; | |
#endif | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
float __pyx_v_constant_roi; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__ (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_constant_roi,0}; | |
PyObject* values[1] = {0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_constant_roi)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 1) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
} | |
__pyx_v_constant_roi = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[0]);<span class='error_goto'> if (unlikely((__pyx_v_constant_roi == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 1, 1, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.ConstantRoI.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return -1; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_11ConstantRoI___init__(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_ConstantRoI *)__pyx_v_self), __pyx_v_constant_roi); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static int __pyx_pf_5pyart_3map_17_gate_to_grid_map_11ConstantRoI___init__(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_ConstantRoI *__pyx_v_self, float __pyx_v_constant_roi) { | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 047: <span class="sd">""" intialize. """</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+048: <span class="bp">self</span><span class="o">.</span><span class="n">constant_roi</span> <span class="o">=</span> <span class="n">constant_roi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_self->constant_roi = __pyx_v_constant_roi; | |
</pre><pre class='cython line score-0'> 049: </pre> | |
<pre class='cython line score-122' onclick='toggleDiv(this)'>+050: <span class="k">cpdef</span> <span class="kt">float</span> <span class="nf">get_roi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">float</span> <span class="n">z</span><span class="p">,</span> <span class="nb">float</span> <span class="n">y</span><span class="p">,</span> <span class="nb">float</span> <span class="n">x</span><span class="p">):</span></pre> | |
<pre class='cython code score-122'>static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static float __pyx_f_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_ConstantRoI *__pyx_v_self, CYTHON_UNUSED float __pyx_v_z, CYTHON_UNUSED float __pyx_v_y, CYTHON_UNUSED float __pyx_v_x, int __pyx_skip_dispatch) { | |
float __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
/* Check if called by wrapper */ | |
if (unlikely(__pyx_skip_dispatch)) ; | |
/* Check if overridden in Python */ | |
else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { | |
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_get_roi);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_3get_roi)) { | |
__pyx_t_3 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_z);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_4 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_y);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
__pyx_t_5 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_x);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
__pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL; | |
__pyx_t_8 = 0; | |
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_6))) { | |
__pyx_t_7 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_6); | |
if (likely(__pyx_t_7)) { | |
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function); | |
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_6, function); | |
__pyx_t_8 = 1; | |
} | |
} | |
__pyx_t_9 = <span class='py_c_api'>PyTuple_New</span>(3+__pyx_t_8);<span class='error_goto'> if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
if (__pyx_t_7) { | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0, __pyx_t_7); <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_7); __pyx_t_7 = NULL; | |
} | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_3); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_5); | |
__pyx_t_3 = 0; | |
__pyx_t_4 = 0; | |
__pyx_t_5 = 0; | |
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_6, __pyx_t_9, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0; | |
__pyx_t_10 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_2);<span class='error_goto'> if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
__pyx_r = __pyx_t_10; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
goto __pyx_L0; | |
} | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
} | |
/* … */ | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); | |
<span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("pyart.map._gate_to_grid_map.ConstantRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); | |
__pyx_r = 0; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
/* Python wrapper */ | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_2get_roi[] = " Return contstant radius of influence. "; | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
float __pyx_v_z; | |
float __pyx_v_y; | |
float __pyx_v_x; | |
PyObject *__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_y,&__pyx_n_s_x,0}; | |
PyObject* values[3] = {0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_roi") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 3) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
} | |
__pyx_v_z = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[0]);<span class='error_goto'> if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_y = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[1]);<span class='error_goto'> if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_x = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[2]);<span class='error_goto'> if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.ConstantRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return NULL; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_2get_roi(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_ConstantRoI *)__pyx_v_self), __pyx_v_z, __pyx_v_y, __pyx_v_x); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static PyObject *__pyx_pf_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_2get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_ConstantRoI *__pyx_v_self, float __pyx_v_z, float __pyx_v_y, float __pyx_v_x) { | |
PyObject *__pyx_r = NULL; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r); | |
__pyx_t_1 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_f_5pyart_3map_17_gate_to_grid_map_11ConstantRoI_get_roi(__pyx_v_self, __pyx_v_z, __pyx_v_y, __pyx_v_x, 1));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_r = __pyx_t_1; | |
__pyx_t_1 = 0; | |
goto __pyx_L0; | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.ConstantRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = NULL; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 051: <span class="sd">""" Return contstant radius of influence. """</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+052: <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">constant_roi</span></pre> | |
<pre class='cython code score-0'> __pyx_r = __pyx_v_self->constant_roi; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 053: </pre> | |
<pre class='cython line score-0'> 054: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+055: <span class="k">cdef</span> <span class="k">class</span> <span class="nf">DistRoI</span><span class="p">(</span><span class="n">RoIFunction</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'>struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistRoI { | |
struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction __pyx_base; | |
float z_factor; | |
float xy_factor; | |
float min_radius; | |
int num_offsets; | |
__Pyx_memviewslice offsets; | |
}; | |
/* … */ | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_DistRoI { | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction __pyx_base; | |
}; | |
static struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_DistRoI *__pyx_vtabptr_5pyart_3map_17_gate_to_grid_map_DistRoI; | |
</pre><pre class='cython line score-0'> 056: <span class="sd">""" Radius of influence which expands with distance from the radar. """</span></pre> | |
<pre class='cython line score-0'> 057: </pre> | |
<pre class='cython line score-0'> 058: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">z_factor</span><span class="p">,</span> <span class="nf">xy_factor</span><span class="p">,</span> <span class="nf">min_radius</span></pre> | |
<pre class='cython line score-0'> 059: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">num_offsets</span></pre> | |
<pre class='cython line score-0'> 060: <span class="k">cdef</span> <span class="kt">float</span>[<span class="p">:,</span> <span class="p">:]</span> <span class="n">offsets</span></pre> | |
<pre class='cython line score-0'> 061: </pre> | |
<pre class='cython line score-61' onclick='toggleDiv(this)'>+062: <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">z_factor</span><span class="p">,</span> <span class="n">xy_factor</span><span class="p">,</span> <span class="n">min_radius</span><span class="p">,</span> <span class="n">offsets</span><span class="p">):</span></pre> | |
<pre class='cython code score-61'>/* Python wrapper */ | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_7DistRoI_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_7DistRoI___init__[] = " initalize. "; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
struct wrapperbase __pyx_wrapperbase_5pyart_3map_17_gate_to_grid_map_7DistRoI___init__; | |
#endif | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_7DistRoI_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
PyObject *__pyx_v_z_factor = 0; | |
PyObject *__pyx_v_xy_factor = 0; | |
PyObject *__pyx_v_min_radius = 0; | |
PyObject *__pyx_v_offsets = 0; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__ (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z_factor,&__pyx_n_s_xy_factor,&__pyx_n_s_min_radius,&__pyx_n_s_offsets,0}; | |
PyObject* values[4] = {0,0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_z_factor)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_xy_factor)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 4, 4, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_min_radius)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 4, 4, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 3: | |
if (likely((values[3] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_offsets)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 4, 4, 3); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 4) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
} | |
__pyx_v_z_factor = values[0]; | |
__pyx_v_xy_factor = values[1]; | |
__pyx_v_min_radius = values[2]; | |
__pyx_v_offsets = values[3]; | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 4, 4, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistRoI.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return -1; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_7DistRoI___init__(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistRoI *)__pyx_v_self), __pyx_v_z_factor, __pyx_v_xy_factor, __pyx_v_min_radius, __pyx_v_offsets); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static int __pyx_pf_5pyart_3map_17_gate_to_grid_map_7DistRoI___init__(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistRoI *__pyx_v_self, PyObject *__pyx_v_z_factor, PyObject *__pyx_v_xy_factor, PyObject *__pyx_v_min_radius, PyObject *__pyx_v_offsets) { | |
PyObject *__pyx_v_i = NULL; | |
PyObject *__pyx_v_z_offset = NULL; | |
PyObject *__pyx_v_y_offset = NULL; | |
PyObject *__pyx_v_x_offset = NULL; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_r = 0; | |
goto __pyx_L0; | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); | |
__PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_10); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_11); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistRoI.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = -1; | |
__pyx_L0:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_i); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_z_offset); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_y_offset); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_x_offset); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 063: <span class="sd">""" initalize. """</span></pre> | |
<pre class='cython line score-5' onclick='toggleDiv(this)'>+064: <span class="bp">self</span><span class="o">.</span><span class="n">z_factor</span> <span class="o">=</span> <span class="n">z_factor</span></pre> | |
<pre class='cython code score-5'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_z_factor);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->z_factor = __pyx_t_1; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+065: <span class="bp">self</span><span class="o">.</span><span class="n">xy_factor</span> <span class="o">=</span> <span class="n">xy_factor</span></pre> | |
<pre class='cython code score-5'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_xy_factor);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->xy_factor = __pyx_t_1; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+066: <span class="bp">self</span><span class="o">.</span><span class="n">min_radius</span> <span class="o">=</span> <span class="n">min_radius</span></pre> | |
<pre class='cython code score-5'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_min_radius);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->min_radius = __pyx_t_1; | |
</pre><pre class='cython line score-0'> 067: </pre> | |
<pre class='cython line score-5' onclick='toggleDiv(this)'>+068: <span class="bp">self</span><span class="o">.</span><span class="n">num_offsets</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">offsets</span><span class="p">)</span></pre> | |
<pre class='cython code score-5'> __pyx_t_2 = <span class='py_c_api'>PyObject_Length</span>(__pyx_v_offsets);<span class='error_goto'> if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->num_offsets = __pyx_t_2; | |
</pre><pre class='cython line score-0'> 069: <span class="c"># does this array need to be explicitly de-allocated when the</span></pre> | |
<pre class='cython line score-0'> 070: <span class="c"># class instance is removed?</span></pre> | |
<pre class='cython line score-11' onclick='toggleDiv(this)'>+071: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span> <span class="o">=</span> <span class="n">cvarray</span><span class="p">(</span></pre> | |
<pre class='cython code score-11'> __pyx_t_3 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
/* … */ | |
__pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(((PyObject *)((PyObject *)__pyx_array_type)), __pyx_empty_tuple, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
__pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_dsds_float</span>(__pyx_t_5); | |
if (unlikely(!__pyx_t_6.memview)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0; | |
__PYX_XDEC_MEMVIEW(&__pyx_v_self->offsets, 0); | |
__pyx_v_self->offsets = __pyx_t_6; | |
__pyx_t_6.memview = NULL; | |
__pyx_t_6.data = NULL; | |
</pre><pre class='cython line score-29' onclick='toggleDiv(this)'>+072: <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">num_offsets</span><span class="p">,</span> <span class="mf">3</span><span class="p">),</span> <span class="n">itemsize</span><span class="o">=</span><span class="n">sizeof</span><span class="p">(</span><span class="nb">float</span><span class="p">),</span> <span class="n">format</span><span class="o">=</span><span class="s">'f'</span><span class="p">)</span></pre> | |
<pre class='cython code score-29'> __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyInt_From_int</span>(__pyx_v_self->num_offsets);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
__pyx_t_5 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_5, 0, __pyx_t_4); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_3); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_5, 1, __pyx_int_3); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_int_3); | |
__pyx_t_4 = 0; | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_shape, __pyx_t_5) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0; | |
__pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyInt_FromSize_t</span>((sizeof(float)));<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_5) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0; | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_f) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
</pre><pre class='cython line score-0'> 073: </pre> | |
<pre class='cython line score-109' onclick='toggleDiv(this)'>+074: <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">z_offset</span><span class="p">,</span> <span class="n">y_offset</span><span class="p">,</span> <span class="n">x_offset</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">offsets</span><span class="p">):</span></pre> | |
<pre class='cython code score-109'> <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_0); | |
__pyx_t_5 = __pyx_int_0; | |
if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_v_offsets)) || <span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_v_offsets)) { | |
__pyx_t_3 = __pyx_v_offsets; <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_3); __pyx_t_2 = 0; | |
__pyx_t_7 = NULL; | |
} else { | |
__pyx_t_2 = -1; __pyx_t_3 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_v_offsets);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
for (;;) { | |
if (likely(!__pyx_t_7)) { | |
if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_3))) { | |
if (__pyx_t_2 >= <span class='py_macro_api'>PyList_GET_SIZE</span>(__pyx_t_3)) break; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_4 = <span class='py_macro_api'>PyList_GET_ITEM</span>(__pyx_t_3, __pyx_t_2); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4); __pyx_t_2++;<span class='error_goto'> if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#else | |
__pyx_t_4 = <span class='py_macro_api'>PySequence_ITEM</span>(__pyx_t_3, __pyx_t_2); __pyx_t_2++;<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#endif | |
} else { | |
if (__pyx_t_2 >= <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_t_3)) break; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_4 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_t_3, __pyx_t_2); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4); __pyx_t_2++;<span class='error_goto'> if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#else | |
__pyx_t_4 = <span class='py_macro_api'>PySequence_ITEM</span>(__pyx_t_3, __pyx_t_2); __pyx_t_2++;<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#endif | |
} | |
} else { | |
__pyx_t_4 = __pyx_t_7(__pyx_t_3); | |
if (unlikely(!__pyx_t_4)) { | |
PyObject* exc_type = <span class='py_c_api'>PyErr_Occurred</span>(); | |
if (exc_type) { | |
if (likely(exc_type == PyExc_StopIteration || <span class='py_c_api'>PyErr_GivenExceptionMatches</span>(exc_type, PyExc_StopIteration))) <span class='py_c_api'>PyErr_Clear</span>(); | |
else <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
break; | |
} | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
} | |
if ((likely(<span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_t_4))) || (<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_4))) { | |
PyObject* sequence = __pyx_t_4; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
Py_ssize_t size = Py_SIZE(sequence); | |
#else | |
Py_ssize_t size = <span class='py_c_api'>PySequence_Size</span>(sequence); | |
#endif | |
if (unlikely(size != 3)) { | |
if (size > 3) <span class='pyx_c_api'>__Pyx_RaiseTooManyValuesError</span>(3); | |
else if (size >= 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(size); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
#if CYTHON_COMPILING_IN_CPYTHON | |
if (likely(<span class='py_c_api'>PyTuple_CheckExact</span>(sequence))) { | |
__pyx_t_8 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 0); | |
__pyx_t_9 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 1); | |
__pyx_t_10 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 2); | |
} else { | |
__pyx_t_8 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 0); | |
__pyx_t_9 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 1); | |
__pyx_t_10 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 2); | |
} | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_8); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_9); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_10); | |
#else | |
__pyx_t_8 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 0);<span class='error_goto'> if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8); | |
__pyx_t_9 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 1);<span class='error_goto'> if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
__pyx_t_10 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 2);<span class='error_goto'> if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_10); | |
#endif | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0; | |
} else { | |
Py_ssize_t index = -1; | |
__pyx_t_11 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0; | |
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; | |
index = 0; __pyx_t_8 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8); | |
index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L5_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_10); | |
if (<span class='pyx_c_api'>__Pyx_IternextUnpackEndCheck</span>(__pyx_t_12(__pyx_t_11), 3) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_12 = NULL; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_11); __pyx_t_11 = 0; | |
goto __pyx_L6_unpacking_done; | |
__pyx_L5_unpacking_failed:; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_11); __pyx_t_11 = 0; | |
__pyx_t_12 = NULL; | |
if (<span class='pyx_c_api'>__Pyx_IterFinish</span>() == 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(index); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_L6_unpacking_done:; | |
} | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_z_offset, __pyx_t_8); | |
__pyx_t_8 = 0; | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_y_offset, __pyx_t_9); | |
__pyx_t_9 = 0; | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_x_offset, __pyx_t_10); | |
__pyx_t_10 = 0; | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_i, __pyx_t_5); | |
__pyx_t_4 = <span class='py_c_api'>PyNumber_Add</span>(__pyx_t_5, __pyx_int_1);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); | |
__pyx_t_5 = __pyx_t_4; | |
__pyx_t_4 = 0; | |
/* … */ | |
} | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0; | |
</pre><pre class='cython line score-14' onclick='toggleDiv(this)'>+075: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">z_offset</span></pre> | |
<pre class='cython code score-14'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_z_offset);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!__pyx_v_self->offsets.memview)) {<span class='py_c_api'>PyErr_SetString</span>(PyExc_AttributeError,"Memoryview is not initialized");<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>} | |
__pyx_t_13 = <span class='pyx_c_api'>__Pyx_PyIndex_AsSsize_t</span>(__pyx_v_i);<span class='error_goto'> if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_14 = __pyx_t_13; | |
__pyx_t_15 = 0; | |
__pyx_t_16 = -1; | |
if (__pyx_t_14 < 0) { | |
__pyx_t_14 += __pyx_v_self->offsets.shape[0]; | |
if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0; | |
} else if (unlikely(__pyx_t_14 >= __pyx_v_self->offsets.shape[0])) __pyx_t_16 = 0; | |
if (__pyx_t_15 < 0) { | |
__pyx_t_15 += __pyx_v_self->offsets.shape[1]; | |
if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1; | |
} else if (unlikely(__pyx_t_15 >= __pyx_v_self->offsets.shape[1])) __pyx_t_16 = 1; | |
if (unlikely(__pyx_t_16 != -1)) { | |
<span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_16); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_14 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_15 * __pyx_v_self->offsets.strides[1]) )) = __pyx_t_1; | |
</pre><pre class='cython line score-14' onclick='toggleDiv(this)'>+076: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">y_offset</span></pre> | |
<pre class='cython code score-14'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_y_offset);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!__pyx_v_self->offsets.memview)) {<span class='py_c_api'>PyErr_SetString</span>(PyExc_AttributeError,"Memoryview is not initialized");<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>} | |
__pyx_t_13 = <span class='pyx_c_api'>__Pyx_PyIndex_AsSsize_t</span>(__pyx_v_i);<span class='error_goto'> if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_17 = __pyx_t_13; | |
__pyx_t_18 = 1; | |
__pyx_t_16 = -1; | |
if (__pyx_t_17 < 0) { | |
__pyx_t_17 += __pyx_v_self->offsets.shape[0]; | |
if (unlikely(__pyx_t_17 < 0)) __pyx_t_16 = 0; | |
} else if (unlikely(__pyx_t_17 >= __pyx_v_self->offsets.shape[0])) __pyx_t_16 = 0; | |
if (__pyx_t_18 < 0) { | |
__pyx_t_18 += __pyx_v_self->offsets.shape[1]; | |
if (unlikely(__pyx_t_18 < 0)) __pyx_t_16 = 1; | |
} else if (unlikely(__pyx_t_18 >= __pyx_v_self->offsets.shape[1])) __pyx_t_16 = 1; | |
if (unlikely(__pyx_t_16 != -1)) { | |
<span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_16); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_17 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_18 * __pyx_v_self->offsets.strides[1]) )) = __pyx_t_1; | |
</pre><pre class='cython line score-14' onclick='toggleDiv(this)'>+077: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">x_offset</span></pre> | |
<pre class='cython code score-14'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_x_offset);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!__pyx_v_self->offsets.memview)) {<span class='py_c_api'>PyErr_SetString</span>(PyExc_AttributeError,"Memoryview is not initialized");<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>} | |
__pyx_t_13 = <span class='pyx_c_api'>__Pyx_PyIndex_AsSsize_t</span>(__pyx_v_i);<span class='error_goto'> if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_19 = __pyx_t_13; | |
__pyx_t_20 = 2; | |
__pyx_t_16 = -1; | |
if (__pyx_t_19 < 0) { | |
__pyx_t_19 += __pyx_v_self->offsets.shape[0]; | |
if (unlikely(__pyx_t_19 < 0)) __pyx_t_16 = 0; | |
} else if (unlikely(__pyx_t_19 >= __pyx_v_self->offsets.shape[0])) __pyx_t_16 = 0; | |
if (__pyx_t_20 < 0) { | |
__pyx_t_20 += __pyx_v_self->offsets.shape[1]; | |
if (unlikely(__pyx_t_20 < 0)) __pyx_t_16 = 1; | |
} else if (unlikely(__pyx_t_20 >= __pyx_v_self->offsets.shape[1])) __pyx_t_16 = 1; | |
if (unlikely(__pyx_t_16 != -1)) { | |
<span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_16); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_19 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_20 * __pyx_v_self->offsets.strides[1]) )) = __pyx_t_1; | |
</pre><pre class='cython line score-0'> 078: </pre> | |
<pre class='cython line score-0'> 079: <span class="nd">@cython</span><span class="o">.</span><span class="n">initializedcheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 080: <span class="nd">@cython</span><span class="o">.</span><span class="n">cdivision</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 081: <span class="nd">@cython</span><span class="o">.</span><span class="n">boundscheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 082: <span class="nd">@cython</span><span class="o">.</span><span class="n">wraparound</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-122' onclick='toggleDiv(this)'>+083: <span class="k">cpdef</span> <span class="kt">float</span> <span class="nf">get_roi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">float</span> <span class="n">z</span><span class="p">,</span> <span class="nb">float</span> <span class="n">y</span><span class="p">,</span> <span class="nb">float</span> <span class="n">x</span><span class="p">):</span></pre> | |
<pre class='cython code score-122'>static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_7DistRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static float __pyx_f_5pyart_3map_17_gate_to_grid_map_7DistRoI_get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistRoI *__pyx_v_self, float __pyx_v_z, float __pyx_v_y, float __pyx_v_x, int __pyx_skip_dispatch) { | |
float __pyx_v_min_roi; | |
float __pyx_v_roi; | |
float __pyx_v_z_offset; | |
float __pyx_v_y_offset; | |
float __pyx_v_x_offset; | |
int __pyx_v_i; | |
float __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
/* Check if called by wrapper */ | |
if (unlikely(__pyx_skip_dispatch)) ; | |
/* Check if overridden in Python */ | |
else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { | |
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_get_roi);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5pyart_3map_17_gate_to_grid_map_7DistRoI_3get_roi)) { | |
__pyx_t_3 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_z);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_4 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_y);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
__pyx_t_5 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_x);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
__pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL; | |
__pyx_t_8 = 0; | |
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_6))) { | |
__pyx_t_7 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_6); | |
if (likely(__pyx_t_7)) { | |
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function); | |
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_6, function); | |
__pyx_t_8 = 1; | |
} | |
} | |
__pyx_t_9 = <span class='py_c_api'>PyTuple_New</span>(3+__pyx_t_8);<span class='error_goto'> if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
if (__pyx_t_7) { | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0, __pyx_t_7); <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_7); __pyx_t_7 = NULL; | |
} | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_3); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_5); | |
__pyx_t_3 = 0; | |
__pyx_t_4 = 0; | |
__pyx_t_5 = 0; | |
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_6, __pyx_t_9, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0; | |
__pyx_t_10 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_2);<span class='error_goto'> if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
__pyx_r = __pyx_t_10; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
goto __pyx_L0; | |
} | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
} | |
/* … */ | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); | |
<span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("pyart.map._gate_to_grid_map.DistRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); | |
__pyx_r = 0; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
/* Python wrapper */ | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_7DistRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_7DistRoI_2get_roi[] = " Return the radius of influence for coordinates in meters. "; | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_7DistRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
float __pyx_v_z; | |
float __pyx_v_y; | |
float __pyx_v_x; | |
PyObject *__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_y,&__pyx_n_s_x,0}; | |
PyObject* values[3] = {0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_roi") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 3) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
} | |
__pyx_v_z = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[0]);<span class='error_goto'> if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_y = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[1]);<span class='error_goto'> if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_x = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[2]);<span class='error_goto'> if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return NULL; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_7DistRoI_2get_roi(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistRoI *)__pyx_v_self), __pyx_v_z, __pyx_v_y, __pyx_v_x); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static PyObject *__pyx_pf_5pyart_3map_17_gate_to_grid_map_7DistRoI_2get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistRoI *__pyx_v_self, float __pyx_v_z, float __pyx_v_y, float __pyx_v_x) { | |
PyObject *__pyx_r = NULL; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r); | |
__pyx_t_1 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_f_5pyart_3map_17_gate_to_grid_map_7DistRoI_get_roi(__pyx_v_self, __pyx_v_z, __pyx_v_y, __pyx_v_x, 1));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_r = __pyx_t_1; | |
__pyx_t_1 = 0; | |
goto __pyx_L0; | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = NULL; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 084: <span class="sd">""" Return the radius of influence for coordinates in meters. """</span></pre> | |
<pre class='cython line score-0'> 085: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">min_roi</span><span class="p">,</span> <span class="nf">roi</span><span class="p">,</span> <span class="nf">z_offset</span><span class="p">,</span> <span class="nf">y_offset</span><span class="p">,</span> <span class="nf">x_offset</span></pre> | |
<pre class='cython line score-0'> 086: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">i</span></pre> | |
<pre class='cython line score-0'> 087: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+088: <span class="n">min_roi</span> <span class="o">=</span> <span class="mf">999999999.0</span></pre> | |
<pre class='cython code score-0'> __pyx_v_min_roi = 999999999.0; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+089: <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">num_offsets</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_11 = __pyx_v_self->num_offsets; | |
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { | |
__pyx_v_i = __pyx_t_12; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+090: <span class="n">z_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">0</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_13 = __pyx_v_i; | |
__pyx_t_8 = 0; | |
__pyx_v_z_offset = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_13 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_8 * __pyx_v_self->offsets.strides[1]) ))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+091: <span class="n">y_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">1</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> | |
/* "pyart/map/_gate_to_grid_map.pyx":91 | |
* for i in range(self.num_offsets): | |
* z_offset = self.offsets[i, 0] | |
* y_offset = self.offsets[i, 1] # <<<<<<<<<<<<<< | |
* x_offset = self.offsets[i, 2] | |
* roi = (self.z_factor * (z - z_offset) + self.xy_factor * | |
*/ | |
__pyx_t_14 = __pyx_v_i; | |
__pyx_t_15 = 1; | |
__pyx_v_y_offset = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_14 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_15 * __pyx_v_self->offsets.strides[1]) ))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+092: <span class="n">x_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">2</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_16 = __pyx_v_i; | |
__pyx_t_17 = 2; | |
__pyx_v_x_offset = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_16 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_17 * __pyx_v_self->offsets.strides[1]) ))); | |
</pre><pre class='cython line score-0'> 093: <span class="n">roi</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_factor</span> <span class="o">*</span> <span class="p">(</span><span class="n">z</span> <span class="o">-</span> <span class="n">z_offset</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">xy_factor</span> <span class="o">*</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+094: <span class="n">sqrt</span><span class="p">((</span><span class="n">x</span> <span class="o">-</span> <span class="n">x_offset</span><span class="p">)</span><span class="o">**</span><span class="mf">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">y_offset</span><span class="p">)</span><span class="o">**</span><span class="mf">2</span><span class="p">)</span> <span class="o">+</span></pre> | |
<pre class='cython code score-0'> __pyx_v_roi = (((__pyx_v_self->z_factor * (__pyx_v_z - __pyx_v_z_offset)) + (__pyx_v_self->xy_factor * sqrt((powf((__pyx_v_x - __pyx_v_x_offset), 2.0) + powf((__pyx_v_y - __pyx_v_y_offset), 2.0))))) + __pyx_v_self->min_radius); | |
</pre><pre class='cython line score-0'> 095: <span class="bp">self</span><span class="o">.</span><span class="n">min_radius</span><span class="p">)</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+096: <span class="k">if</span> <span class="n">roi</span> <span class="o"><</span> <span class="n">min_roi</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_18 = ((__pyx_v_roi < __pyx_v_min_roi) != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+097: <span class="n">min_roi</span> <span class="o">=</span> <span class="n">roi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_min_roi = __pyx_v_roi; | |
goto __pyx_L5; | |
} | |
__pyx_L5:; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+098: <span class="k">return</span> <span class="n">min_roi</span></pre> | |
<pre class='cython code score-0'> __pyx_r = __pyx_v_min_roi; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 099: </pre> | |
<pre class='cython line score-0'> 100: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+101: <span class="k">cdef</span> <span class="k">class</span> <span class="nf">DistBeamRoI</span><span class="p">(</span><span class="n">RoIFunction</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'>struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistBeamRoI { | |
struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction __pyx_base; | |
float h_factor; | |
float min_radius; | |
float beam_factor; | |
int num_offsets; | |
__Pyx_memviewslice offsets; | |
}; | |
/* … */ | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_DistBeamRoI { | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction __pyx_base; | |
}; | |
static struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_DistBeamRoI *__pyx_vtabptr_5pyart_3map_17_gate_to_grid_map_DistBeamRoI; | |
</pre><pre class='cython line score-0'> 102: <span class="sd">"""</span></pre> | |
<pre class='cython line score-0'> 103: <span class="sd"> Radius of influence which expands with distance from multiple radars.</span></pre> | |
<pre class='cython line score-0'> 104: <span class="sd"> """</span></pre> | |
<pre class='cython line score-0'> 105: </pre> | |
<pre class='cython line score-0'> 106: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">h_factor</span><span class="p">,</span> <span class="nf">min_radius</span><span class="p">,</span> <span class="nf">beam_factor</span></pre> | |
<pre class='cython line score-0'> 107: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">num_offsets</span></pre> | |
<pre class='cython line score-0'> 108: <span class="k">cdef</span> <span class="kt">float</span>[<span class="p">:,</span> <span class="p">:]</span> <span class="n">offsets</span></pre> | |
<pre class='cython line score-0'> 109: </pre> | |
<pre class='cython line score-70' onclick='toggleDiv(this)'>+110: <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">h_factor</span><span class="p">,</span> <span class="n">nb</span><span class="p">,</span> <span class="n">bsp</span><span class="p">,</span> <span class="n">min_radius</span><span class="p">,</span> <span class="n">offsets</span><span class="p">):</span></pre> | |
<pre class='cython code score-70'>/* Python wrapper */ | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI___init__[] = " initalize. "; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
struct wrapperbase __pyx_wrapperbase_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI___init__; | |
#endif | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
PyObject *__pyx_v_h_factor = 0; | |
PyObject *__pyx_v_nb = 0; | |
PyObject *__pyx_v_bsp = 0; | |
PyObject *__pyx_v_min_radius = 0; | |
PyObject *__pyx_v_offsets = 0; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__ (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_h_factor,&__pyx_n_s_nb,&__pyx_n_s_bsp,&__pyx_n_s_min_radius,&__pyx_n_s_offsets,0}; | |
PyObject* values[5] = {0,0,0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 5: values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4); | |
case 4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_h_factor)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_nb)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_bsp)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 3: | |
if (likely((values[3] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_min_radius)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 3); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 4: | |
if (likely((values[4] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_offsets)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 4); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 5) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4); | |
} | |
__pyx_v_h_factor = values[0]; | |
__pyx_v_nb = values[1]; | |
__pyx_v_bsp = values[2]; | |
__pyx_v_min_radius = values[3]; | |
__pyx_v_offsets = values[4]; | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistBeamRoI.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return -1; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI___init__(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistBeamRoI *)__pyx_v_self), __pyx_v_h_factor, __pyx_v_nb, __pyx_v_bsp, __pyx_v_min_radius, __pyx_v_offsets); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static int __pyx_pf_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI___init__(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistBeamRoI *__pyx_v_self, PyObject *__pyx_v_h_factor, PyObject *__pyx_v_nb, PyObject *__pyx_v_bsp, PyObject *__pyx_v_min_radius, PyObject *__pyx_v_offsets) { | |
PyObject *__pyx_v_i = NULL; | |
PyObject *__pyx_v_z_offset = NULL; | |
PyObject *__pyx_v_y_offset = NULL; | |
PyObject *__pyx_v_x_offset = NULL; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_r = 0; | |
goto __pyx_L0; | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
__PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_10); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_11); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_12); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistBeamRoI.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = -1; | |
__pyx_L0:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_i); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_z_offset); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_y_offset); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_x_offset); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 111: <span class="sd">""" initalize. """</span></pre> | |
<pre class='cython line score-5' onclick='toggleDiv(this)'>+112: <span class="bp">self</span><span class="o">.</span><span class="n">h_factor</span> <span class="o">=</span> <span class="n">h_factor</span></pre> | |
<pre class='cython code score-5'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_h_factor);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->h_factor = __pyx_t_1; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+113: <span class="bp">self</span><span class="o">.</span><span class="n">min_radius</span> <span class="o">=</span> <span class="n">min_radius</span></pre> | |
<pre class='cython code score-5'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_min_radius);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->min_radius = __pyx_t_1; | |
</pre><pre class='cython line score-26' onclick='toggleDiv(this)'>+114: <span class="bp">self</span><span class="o">.</span><span class="n">beam_factor</span> <span class="o">=</span> <span class="n">tan</span><span class="p">(</span><span class="n">nb</span> <span class="o">*</span> <span class="n">bsp</span> <span class="o">*</span> <span class="n">PI</span> <span class="o">/</span> <span class="mf">180.</span><span class="p">)</span></pre> | |
<pre class='cython code score-26'> __pyx_t_2 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_v_nb, __pyx_v_bsp);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
__pyx_t_3 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_5pyart_3map_17_gate_to_grid_map_PI);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_4 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_2, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyNumber_Divide</span>(__pyx_t_4, __pyx_float_180_);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0; | |
__pyx_t_5 = __pyx_<span class='py_c_api'>PyFloat_AsDouble</span>(__pyx_t_3);<span class='error_goto'> if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
__pyx_v_self->beam_factor = tan(__pyx_t_5); | |
</pre><pre class='cython line score-0'> 115: </pre> | |
<pre class='cython line score-5' onclick='toggleDiv(this)'>+116: <span class="bp">self</span><span class="o">.</span><span class="n">num_offsets</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">offsets</span><span class="p">)</span></pre> | |
<pre class='cython code score-5'> __pyx_t_6 = <span class='py_c_api'>PyObject_Length</span>(__pyx_v_offsets);<span class='error_goto'> if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->num_offsets = __pyx_t_6; | |
</pre><pre class='cython line score-0'> 117: <span class="c"># does this array need to be explicitly de-allocated when the</span></pre> | |
<pre class='cython line score-0'> 118: <span class="c"># class instance is removed?</span></pre> | |
<pre class='cython line score-11' onclick='toggleDiv(this)'>+119: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span> <span class="o">=</span> <span class="n">cvarray</span><span class="p">(</span></pre> | |
<pre class='cython code score-11'> __pyx_t_3 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
/* … */ | |
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(((PyObject *)((PyObject *)__pyx_array_type)), __pyx_empty_tuple, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
__pyx_t_7 = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_dsds_float</span>(__pyx_t_2); | |
if (unlikely(!__pyx_t_7.memview)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
__PYX_XDEC_MEMVIEW(&__pyx_v_self->offsets, 0); | |
__pyx_v_self->offsets = __pyx_t_7; | |
__pyx_t_7.memview = NULL; | |
__pyx_t_7.data = NULL; | |
</pre><pre class='cython line score-29' onclick='toggleDiv(this)'>+120: <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">num_offsets</span><span class="p">,</span> <span class="mf">3</span><span class="p">),</span> <span class="n">itemsize</span><span class="o">=</span><span class="n">sizeof</span><span class="p">(</span><span class="nb">float</span><span class="p">),</span> <span class="n">format</span><span class="o">=</span><span class="s">'f'</span><span class="p">)</span></pre> | |
<pre class='cython code score-29'> __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyInt_From_int</span>(__pyx_v_self->num_offsets);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
__pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_t_4); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_3); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 1, __pyx_int_3); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_int_3); | |
__pyx_t_4 = 0; | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_shape, __pyx_t_2) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyInt_FromSize_t</span>((sizeof(float)));<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_2) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_f) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
</pre><pre class='cython line score-0'> 121: </pre> | |
<pre class='cython line score-109' onclick='toggleDiv(this)'>+122: <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">z_offset</span><span class="p">,</span> <span class="n">y_offset</span><span class="p">,</span> <span class="n">x_offset</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">offsets</span><span class="p">):</span></pre> | |
<pre class='cython code score-109'> <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_0); | |
__pyx_t_2 = __pyx_int_0; | |
if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_v_offsets)) || <span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_v_offsets)) { | |
__pyx_t_3 = __pyx_v_offsets; <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_3); __pyx_t_6 = 0; | |
__pyx_t_8 = NULL; | |
} else { | |
__pyx_t_6 = -1; __pyx_t_3 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_v_offsets);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;<span class='error_goto'> if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
for (;;) { | |
if (likely(!__pyx_t_8)) { | |
if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_3))) { | |
if (__pyx_t_6 >= <span class='py_macro_api'>PyList_GET_SIZE</span>(__pyx_t_3)) break; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_4 = <span class='py_macro_api'>PyList_GET_ITEM</span>(__pyx_t_3, __pyx_t_6); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4); __pyx_t_6++;<span class='error_goto'> if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#else | |
__pyx_t_4 = <span class='py_macro_api'>PySequence_ITEM</span>(__pyx_t_3, __pyx_t_6); __pyx_t_6++;<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#endif | |
} else { | |
if (__pyx_t_6 >= <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_t_3)) break; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_4 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_t_3, __pyx_t_6); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4); __pyx_t_6++;<span class='error_goto'> if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#else | |
__pyx_t_4 = <span class='py_macro_api'>PySequence_ITEM</span>(__pyx_t_3, __pyx_t_6); __pyx_t_6++;<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
#endif | |
} | |
} else { | |
__pyx_t_4 = __pyx_t_8(__pyx_t_3); | |
if (unlikely(!__pyx_t_4)) { | |
PyObject* exc_type = <span class='py_c_api'>PyErr_Occurred</span>(); | |
if (exc_type) { | |
if (likely(exc_type == PyExc_StopIteration || <span class='py_c_api'>PyErr_GivenExceptionMatches</span>(exc_type, PyExc_StopIteration))) <span class='py_c_api'>PyErr_Clear</span>(); | |
else <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
break; | |
} | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
} | |
if ((likely(<span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_t_4))) || (<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_4))) { | |
PyObject* sequence = __pyx_t_4; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
Py_ssize_t size = Py_SIZE(sequence); | |
#else | |
Py_ssize_t size = <span class='py_c_api'>PySequence_Size</span>(sequence); | |
#endif | |
if (unlikely(size != 3)) { | |
if (size > 3) <span class='pyx_c_api'>__Pyx_RaiseTooManyValuesError</span>(3); | |
else if (size >= 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(size); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
#if CYTHON_COMPILING_IN_CPYTHON | |
if (likely(<span class='py_c_api'>PyTuple_CheckExact</span>(sequence))) { | |
__pyx_t_9 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 0); | |
__pyx_t_10 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 1); | |
__pyx_t_11 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 2); | |
} else { | |
__pyx_t_9 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 0); | |
__pyx_t_10 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 1); | |
__pyx_t_11 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 2); | |
} | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_9); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_10); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_11); | |
#else | |
__pyx_t_9 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 0);<span class='error_goto'> if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
__pyx_t_10 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 1);<span class='error_goto'> if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_10); | |
__pyx_t_11 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 2);<span class='error_goto'> if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11); | |
#endif | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0; | |
} else { | |
Py_ssize_t index = -1; | |
__pyx_t_12 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_12); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0; | |
__pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext; | |
index = 0; __pyx_t_9 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L5_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_10); | |
index = 2; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L5_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11); | |
if (<span class='pyx_c_api'>__Pyx_IternextUnpackEndCheck</span>(__pyx_t_13(__pyx_t_12), 3) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_13 = NULL; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_12); __pyx_t_12 = 0; | |
goto __pyx_L6_unpacking_done; | |
__pyx_L5_unpacking_failed:; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_12); __pyx_t_12 = 0; | |
__pyx_t_13 = NULL; | |
if (<span class='pyx_c_api'>__Pyx_IterFinish</span>() == 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(index); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_L6_unpacking_done:; | |
} | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_z_offset, __pyx_t_9); | |
__pyx_t_9 = 0; | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_y_offset, __pyx_t_10); | |
__pyx_t_10 = 0; | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_x_offset, __pyx_t_11); | |
__pyx_t_11 = 0; | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_i, __pyx_t_2); | |
__pyx_t_4 = <span class='py_c_api'>PyNumber_Add</span>(__pyx_t_2, __pyx_int_1);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); | |
__pyx_t_2 = __pyx_t_4; | |
__pyx_t_4 = 0; | |
/* … */ | |
} | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
</pre><pre class='cython line score-14' onclick='toggleDiv(this)'>+123: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">z_offset</span></pre> | |
<pre class='cython code score-14'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_z_offset);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!__pyx_v_self->offsets.memview)) {<span class='py_c_api'>PyErr_SetString</span>(PyExc_AttributeError,"Memoryview is not initialized");<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>} | |
__pyx_t_14 = <span class='pyx_c_api'>__Pyx_PyIndex_AsSsize_t</span>(__pyx_v_i);<span class='error_goto'> if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_15 = __pyx_t_14; | |
__pyx_t_16 = 0; | |
__pyx_t_17 = -1; | |
if (__pyx_t_15 < 0) { | |
__pyx_t_15 += __pyx_v_self->offsets.shape[0]; | |
if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0; | |
} else if (unlikely(__pyx_t_15 >= __pyx_v_self->offsets.shape[0])) __pyx_t_17 = 0; | |
if (__pyx_t_16 < 0) { | |
__pyx_t_16 += __pyx_v_self->offsets.shape[1]; | |
if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1; | |
} else if (unlikely(__pyx_t_16 >= __pyx_v_self->offsets.shape[1])) __pyx_t_17 = 1; | |
if (unlikely(__pyx_t_17 != -1)) { | |
<span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_17); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_15 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_16 * __pyx_v_self->offsets.strides[1]) )) = __pyx_t_1; | |
</pre><pre class='cython line score-14' onclick='toggleDiv(this)'>+124: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">y_offset</span></pre> | |
<pre class='cython code score-14'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_y_offset);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!__pyx_v_self->offsets.memview)) {<span class='py_c_api'>PyErr_SetString</span>(PyExc_AttributeError,"Memoryview is not initialized");<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>} | |
__pyx_t_14 = <span class='pyx_c_api'>__Pyx_PyIndex_AsSsize_t</span>(__pyx_v_i);<span class='error_goto'> if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_18 = __pyx_t_14; | |
__pyx_t_19 = 1; | |
__pyx_t_17 = -1; | |
if (__pyx_t_18 < 0) { | |
__pyx_t_18 += __pyx_v_self->offsets.shape[0]; | |
if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0; | |
} else if (unlikely(__pyx_t_18 >= __pyx_v_self->offsets.shape[0])) __pyx_t_17 = 0; | |
if (__pyx_t_19 < 0) { | |
__pyx_t_19 += __pyx_v_self->offsets.shape[1]; | |
if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1; | |
} else if (unlikely(__pyx_t_19 >= __pyx_v_self->offsets.shape[1])) __pyx_t_17 = 1; | |
if (unlikely(__pyx_t_17 != -1)) { | |
<span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_17); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_18 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_19 * __pyx_v_self->offsets.strides[1]) )) = __pyx_t_1; | |
</pre><pre class='cython line score-14' onclick='toggleDiv(this)'>+125: <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">x_offset</span></pre> | |
<pre class='cython code score-14'> __pyx_t_1 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_x_offset);<span class='error_goto'> if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!__pyx_v_self->offsets.memview)) {<span class='py_c_api'>PyErr_SetString</span>(PyExc_AttributeError,"Memoryview is not initialized");<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>} | |
__pyx_t_14 = <span class='pyx_c_api'>__Pyx_PyIndex_AsSsize_t</span>(__pyx_v_i);<span class='error_goto'> if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_20 = __pyx_t_14; | |
__pyx_t_21 = 2; | |
__pyx_t_17 = -1; | |
if (__pyx_t_20 < 0) { | |
__pyx_t_20 += __pyx_v_self->offsets.shape[0]; | |
if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 0; | |
} else if (unlikely(__pyx_t_20 >= __pyx_v_self->offsets.shape[0])) __pyx_t_17 = 0; | |
if (__pyx_t_21 < 0) { | |
__pyx_t_21 += __pyx_v_self->offsets.shape[1]; | |
if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 1; | |
} else if (unlikely(__pyx_t_21 >= __pyx_v_self->offsets.shape[1])) __pyx_t_17 = 1; | |
if (unlikely(__pyx_t_17 != -1)) { | |
<span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_17); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_20 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_21 * __pyx_v_self->offsets.strides[1]) )) = __pyx_t_1; | |
</pre><pre class='cython line score-0'> 126: </pre> | |
<pre class='cython line score-0'> 127: <span class="nd">@cython</span><span class="o">.</span><span class="n">initializedcheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 128: <span class="nd">@cython</span><span class="o">.</span><span class="n">cdivision</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 129: <span class="nd">@cython</span><span class="o">.</span><span class="n">boundscheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 130: <span class="nd">@cython</span><span class="o">.</span><span class="n">wraparound</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-122' onclick='toggleDiv(this)'>+131: <span class="k">cpdef</span> <span class="kt">float</span> <span class="nf">get_roi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">float</span> <span class="n">z</span><span class="p">,</span> <span class="nb">float</span> <span class="n">y</span><span class="p">,</span> <span class="nb">float</span> <span class="n">x</span><span class="p">):</span></pre> | |
<pre class='cython code score-122'>static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static float __pyx_f_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistBeamRoI *__pyx_v_self, float __pyx_v_z, float __pyx_v_y, float __pyx_v_x, int __pyx_skip_dispatch) { | |
float __pyx_v_min_roi; | |
float __pyx_v_roi; | |
float __pyx_v_z_offset; | |
float __pyx_v_y_offset; | |
float __pyx_v_x_offset; | |
int __pyx_v_i; | |
float __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
/* Check if called by wrapper */ | |
if (unlikely(__pyx_skip_dispatch)) ; | |
/* Check if overridden in Python */ | |
else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { | |
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_get_roi);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_3get_roi)) { | |
__pyx_t_3 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_z);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_4 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_y);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
__pyx_t_5 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_x);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
__pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL; | |
__pyx_t_8 = 0; | |
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_6))) { | |
__pyx_t_7 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_6); | |
if (likely(__pyx_t_7)) { | |
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function); | |
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_6, function); | |
__pyx_t_8 = 1; | |
} | |
} | |
__pyx_t_9 = <span class='py_c_api'>PyTuple_New</span>(3+__pyx_t_8);<span class='error_goto'> if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9); | |
if (__pyx_t_7) { | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0, __pyx_t_7); <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_7); __pyx_t_7 = NULL; | |
} | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_3); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4); | |
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5); | |
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_5); | |
__pyx_t_3 = 0; | |
__pyx_t_4 = 0; | |
__pyx_t_5 = 0; | |
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_6, __pyx_t_9, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0; | |
__pyx_t_10 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_2);<span class='error_goto'> if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0; | |
__pyx_r = __pyx_t_10; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
goto __pyx_L0; | |
} | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
} | |
/* … */ | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); | |
<span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("pyart.map._gate_to_grid_map.DistBeamRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); | |
__pyx_r = 0; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
/* Python wrapper */ | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_2get_roi[] = " Return the radius of influence for coordinates in meters. "; | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_3get_roi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
float __pyx_v_z; | |
float __pyx_v_y; | |
float __pyx_v_x; | |
PyObject *__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_y,&__pyx_n_s_x,0}; | |
PyObject* values[3] = {0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_roi") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 3) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
} | |
__pyx_v_z = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[0]);<span class='error_goto'> if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_y = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[1]);<span class='error_goto'> if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_x = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[2]);<span class='error_goto'> if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("get_roi", 1, 3, 3, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistBeamRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return NULL; | |
__pyx_L4_argument_unpacking_done:; | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_2get_roi(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistBeamRoI *)__pyx_v_self), __pyx_v_z, __pyx_v_y, __pyx_v_x); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static PyObject *__pyx_pf_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_2get_roi(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_DistBeamRoI *__pyx_v_self, float __pyx_v_z, float __pyx_v_y, float __pyx_v_x) { | |
PyObject *__pyx_r = NULL; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("get_roi", 0); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r); | |
__pyx_t_1 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_f_5pyart_3map_17_gate_to_grid_map_11DistBeamRoI_get_roi(__pyx_v_self, __pyx_v_z, __pyx_v_y, __pyx_v_x, 1));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_r = __pyx_t_1; | |
__pyx_t_1 = 0; | |
goto __pyx_L0; | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.DistBeamRoI.get_roi", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = NULL; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 132: <span class="sd">""" Return the radius of influence for coordinates in meters. """</span></pre> | |
<pre class='cython line score-0'> 133: </pre> | |
<pre class='cython line score-0'> 134: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">min_roi</span><span class="p">,</span> <span class="nf">roi</span><span class="p">,</span> <span class="nf">z_offset</span><span class="p">,</span> <span class="nf">y_offset</span><span class="p">,</span> <span class="nf">x_offset</span></pre> | |
<pre class='cython line score-0'> 135: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">i</span></pre> | |
<pre class='cython line score-0'> 136: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+137: <span class="n">min_roi</span> <span class="o">=</span> <span class="mf">999999999.0</span></pre> | |
<pre class='cython code score-0'> __pyx_v_min_roi = 999999999.0; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+138: <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">num_offsets</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_11 = __pyx_v_self->num_offsets; | |
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { | |
__pyx_v_i = __pyx_t_12; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+139: <span class="n">z_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">0</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_13 = __pyx_v_i; | |
__pyx_t_8 = 0; | |
__pyx_v_z_offset = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_13 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_8 * __pyx_v_self->offsets.strides[1]) ))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+140: <span class="n">y_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">1</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_14 = __pyx_v_i; | |
__pyx_t_15 = 1; | |
__pyx_v_y_offset = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_14 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_15 * __pyx_v_self->offsets.strides[1]) ))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+141: <span class="n">x_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="mf">2</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> | |
/* "pyart/map/_gate_to_grid_map.pyx":141 | |
* z_offset = self.offsets[i, 0] | |
* y_offset = self.offsets[i, 1] | |
* x_offset = self.offsets[i, 2] # <<<<<<<<<<<<<< | |
* roi = (self.h_factor * ((z - z_offset) / 20.0) + | |
* sqrt((y - y_offset)**2 + (x - x_offset)**2) * | |
*/ | |
__pyx_t_16 = __pyx_v_i; | |
__pyx_t_17 = 2; | |
__pyx_v_x_offset = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->offsets.data + __pyx_t_16 * __pyx_v_self->offsets.strides[0]) ) + __pyx_t_17 * __pyx_v_self->offsets.strides[1]) ))); | |
</pre><pre class='cython line score-0'> 142: <span class="n">roi</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">h_factor</span> <span class="o">*</span> <span class="p">((</span><span class="n">z</span> <span class="o">-</span> <span class="n">z_offset</span><span class="p">)</span> <span class="o">/</span> <span class="mf">20.0</span><span class="p">)</span> <span class="o">+</span></pre> | |
<pre class='cython line score-0'> 143: <span class="n">sqrt</span><span class="p">((</span><span class="n">y</span> <span class="o">-</span> <span class="n">y_offset</span><span class="p">)</span><span class="o">**</span><span class="mf">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">x_offset</span><span class="p">)</span><span class="o">**</span><span class="mf">2</span><span class="p">)</span> <span class="o">*</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+144: <span class="bp">self</span><span class="o">.</span><span class="n">beam_factor</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">min_radius</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_roi = (((__pyx_v_self->h_factor * ((__pyx_v_z - __pyx_v_z_offset) / 20.0)) + (sqrt((powf((__pyx_v_y - __pyx_v_y_offset), 2.0) + powf((__pyx_v_x - __pyx_v_x_offset), 2.0))) * __pyx_v_self->beam_factor)) + __pyx_v_self->min_radius); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+145: <span class="k">if</span> <span class="n">roi</span> <span class="o"><</span> <span class="n">min_roi</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_18 = ((__pyx_v_roi < __pyx_v_min_roi) != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+146: <span class="n">min_roi</span> <span class="o">=</span> <span class="n">roi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_min_roi = __pyx_v_roi; | |
goto __pyx_L5; | |
} | |
__pyx_L5:; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+147: <span class="k">return</span> <span class="n">min_roi</span></pre> | |
<pre class='cython code score-0'> __pyx_r = __pyx_v_min_roi; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 148: </pre> | |
<pre class='cython line score-0'> 149: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+150: <span class="k">cdef</span> <span class="k">class</span> <span class="nf">GateToGridMapper</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'>struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper { | |
PyObject_HEAD | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *__pyx_vtab; | |
float x_step; | |
float y_step; | |
float z_step; | |
float x_start; | |
float y_start; | |
float z_start; | |
int nx; | |
int ny; | |
int nz; | |
int nfields; | |
__Pyx_memviewslice grid_sum; | |
__Pyx_memviewslice grid_wsum; | |
}; | |
/* … */ | |
struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_GateToGridMapper { | |
int (*map_gate)(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *, float, float, float, float, __Pyx_memviewslice, __Pyx_memviewslice, int); | |
}; | |
static struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *__pyx_vtabptr_5pyart_3map_17_gate_to_grid_map_GateToGridMapper; | |
</pre><pre class='cython line score-0'> 151: <span class="sd">"""</span></pre> | |
<pre class='cython line score-0'> 152: <span class="sd"> A class for efficient mapping of radar gates to a regular grid by</span></pre> | |
<pre class='cython line score-0'> 153: <span class="sd"> weighting all gates within a specified radius of influence by distance.</span></pre> | |
<pre class='cython line score-0'> 154: </pre> | |
<pre class='cython line score-0'> 155: <span class="sd"> Parameters</span></pre> | |
<pre class='cython line score-0'> 156: <span class="sd"> ----------</span></pre> | |
<pre class='cython line score-0'> 157: <span class="sd"> grid_shape, : tuple of ints</span></pre> | |
<pre class='cython line score-0'> 158: <span class="sd"> Shape of the grid along the z, y, and x dimensions.</span></pre> | |
<pre class='cython line score-0'> 159: <span class="sd"> grid_starts, grid_steps : tuple of ints</span></pre> | |
<pre class='cython line score-0'> 160: <span class="sd"> Starting points and step sizes in meters of the grid along the</span></pre> | |
<pre class='cython line score-0'> 161: <span class="sd"> z, y and x dimensions.</span></pre> | |
<pre class='cython line score-0'> 162: <span class="sd"> grid_sum, grid_wsum : 4D float32 array</span></pre> | |
<pre class='cython line score-0'> 163: <span class="sd"> Array for collecting grid weighted values and weights for each grid</span></pre> | |
<pre class='cython line score-0'> 164: <span class="sd"> point and field. Dimension are order z, y, x, and fields. These array</span></pre> | |
<pre class='cython line score-0'> 165: <span class="sd"> are modified in place when mapping gates unto the grid.</span></pre> | |
<pre class='cython line score-0'> 166: </pre> | |
<pre class='cython line score-0'> 167: <span class="sd"> """</span></pre> | |
<pre class='cython line score-0'> 168: </pre> | |
<pre class='cython line score-0'> 169: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">x_step</span><span class="p">,</span> <span class="nf">y_step</span><span class="p">,</span> <span class="nf">z_step</span></pre> | |
<pre class='cython line score-0'> 170: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">x_start</span><span class="p">,</span> <span class="nf">y_start</span><span class="p">,</span> <span class="nf">z_start</span></pre> | |
<pre class='cython line score-0'> 171: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">nx</span><span class="p">,</span> <span class="nf">ny</span><span class="p">,</span> <span class="nf">nz</span><span class="p">,</span> <span class="nf">nfields</span></pre> | |
<pre class='cython line score-0'> 172: <span class="k">cdef</span> <span class="kt">float</span>[<span class="p">:,</span> <span class="p">:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">grid_sum</span></pre> | |
<pre class='cython line score-0'> 173: <span class="k">cdef</span> <span class="kt">float</span>[<span class="p">:,</span> <span class="p">:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">grid_wsum</span></pre> | |
<pre class='cython line score-0'> 174: </pre> | |
<pre class='cython line score-81' onclick='toggleDiv(this)'>+175: <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">tuple</span> <span class="n">grid_shape</span><span class="p">,</span> <span class="nb">tuple</span> <span class="n">grid_starts</span><span class="p">,</span> <span class="nb">tuple</span> <span class="n">grid_steps</span><span class="p">,</span></pre> | |
<pre class='cython code score-81'>/* Python wrapper */ | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper___init__[] = " initialize. "; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
struct wrapperbase __pyx_wrapperbase_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper___init__; | |
#endif | |
static int __pyx_pw_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
PyObject *__pyx_v_grid_shape = 0; | |
PyObject *__pyx_v_grid_starts = 0; | |
PyObject *__pyx_v_grid_steps = 0; | |
__Pyx_memviewslice __pyx_v_grid_sum = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
__Pyx_memviewslice __pyx_v_grid_wsum = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__ (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grid_shape,&__pyx_n_s_grid_starts,&__pyx_n_s_grid_steps,&__pyx_n_s_grid_sum,&__pyx_n_s_grid_wsum,0}; | |
PyObject* values[5] = {0,0,0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 5: values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4); | |
case 4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_grid_shape)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_grid_starts)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_grid_steps)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 3: | |
if (likely((values[3] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_grid_sum)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 3); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 4: | |
if (likely((values[4] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_grid_wsum)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 4); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 5) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4); | |
} | |
__pyx_v_grid_shape = ((PyObject*)values[0]); | |
__pyx_v_grid_starts = ((PyObject*)values[1]); | |
__pyx_v_grid_steps = ((PyObject*)values[2]); | |
__pyx_v_grid_sum = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float</span>(values[3]);<span class='error_goto'> if (unlikely(!__pyx_v_grid_sum.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_grid_wsum = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float</span>(values[4]);<span class='error_goto'> if (unlikely(!__pyx_v_grid_wsum.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.GateToGridMapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return -1; | |
__pyx_L4_argument_unpacking_done:; | |
if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_grid_shape), (&PyTuple_Type), 1, "grid_shape", 1))) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_grid_starts), (&PyTuple_Type), 1, "grid_starts", 1))) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_grid_steps), (&PyTuple_Type), 1, "grid_steps", 1))) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper___init__(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *)__pyx_v_self), __pyx_v_grid_shape, __pyx_v_grid_starts, __pyx_v_grid_steps, __pyx_v_grid_sum, __pyx_v_grid_wsum); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
goto __pyx_L0; | |
__pyx_L1_error:; | |
__pyx_r = -1; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static int __pyx_pf_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper___init__(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *__pyx_v_self, PyObject *__pyx_v_grid_shape, PyObject *__pyx_v_grid_starts, PyObject *__pyx_v_grid_steps, __Pyx_memviewslice __pyx_v_grid_sum, __Pyx_memviewslice __pyx_v_grid_wsum) { | |
PyObject *__pyx_v_nz = NULL; | |
PyObject *__pyx_v_ny = NULL; | |
PyObject *__pyx_v_nx = NULL; | |
PyObject *__pyx_v_z_start = NULL; | |
PyObject *__pyx_v_y_start = NULL; | |
PyObject *__pyx_v_x_start = NULL; | |
PyObject *__pyx_v_z_step = NULL; | |
PyObject *__pyx_v_y_step = NULL; | |
PyObject *__pyx_v_x_step = NULL; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.GateToGridMapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = -1; | |
__pyx_L0:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_nz); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_ny); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_nx); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_z_start); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_y_start); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_x_start); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_z_step); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_y_step); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_x_step); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_grid_sum, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_grid_wsum, 1); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 176: <span class="nb">float</span><span class="p">[:,</span> <span class="p">:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">grid_sum</span><span class="p">,</span> <span class="nb">float</span><span class="p">[:,</span> <span class="p">:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">grid_wsum</span><span class="p">):</span></pre> | |
<pre class='cython line score-0'> 177: <span class="sd">""" initialize. """</span></pre> | |
<pre class='cython line score-0'> 178: </pre> | |
<pre class='cython line score-0'> 179: <span class="c"># unpack tuples</span></pre> | |
<pre class='cython line score-20' onclick='toggleDiv(this)'>+180: <span class="n">nz</span><span class="p">,</span> <span class="n">ny</span><span class="p">,</span> <span class="n">nx</span> <span class="o">=</span> <span class="n">grid_shape</span></pre> | |
<pre class='cython code score-20'> if (likely(__pyx_v_grid_shape != Py_None)) { | |
PyObject* sequence = __pyx_v_grid_shape; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
Py_ssize_t size = Py_SIZE(sequence); | |
#else | |
Py_ssize_t size = <span class='py_c_api'>PySequence_Size</span>(sequence); | |
#endif | |
if (unlikely(size != 3)) { | |
if (size > 3) <span class='pyx_c_api'>__Pyx_RaiseTooManyValuesError</span>(3); | |
else if (size >= 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(size); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_1 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 0); | |
__pyx_t_2 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 1); | |
__pyx_t_3 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 2); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_3); | |
#else | |
__pyx_t_1 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_t_2 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
__pyx_t_3 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
#endif | |
} else { | |
<span class='pyx_c_api'>__Pyx_RaiseNoneNotIterableError</span>(); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_v_nz = __pyx_t_1; | |
__pyx_t_1 = 0; | |
__pyx_v_ny = __pyx_t_2; | |
__pyx_t_2 = 0; | |
__pyx_v_nx = __pyx_t_3; | |
__pyx_t_3 = 0; | |
</pre><pre class='cython line score-20' onclick='toggleDiv(this)'>+181: <span class="n">z_start</span><span class="p">,</span> <span class="n">y_start</span><span class="p">,</span> <span class="n">x_start</span> <span class="o">=</span> <span class="n">grid_starts</span></pre> | |
<pre class='cython code score-20'> if (likely(__pyx_v_grid_starts != Py_None)) { | |
PyObject* sequence = __pyx_v_grid_starts; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
Py_ssize_t size = Py_SIZE(sequence); | |
#else | |
Py_ssize_t size = <span class='py_c_api'>PySequence_Size</span>(sequence); | |
#endif | |
if (unlikely(size != 3)) { | |
if (size > 3) <span class='pyx_c_api'>__Pyx_RaiseTooManyValuesError</span>(3); | |
else if (size >= 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(size); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_3 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 0); | |
__pyx_t_2 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 1); | |
__pyx_t_1 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 2); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
#else | |
__pyx_t_3 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 0);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_2 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
__pyx_t_1 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 2);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
#endif | |
} else { | |
<span class='pyx_c_api'>__Pyx_RaiseNoneNotIterableError</span>(); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_v_z_start = __pyx_t_3; | |
__pyx_t_3 = 0; | |
__pyx_v_y_start = __pyx_t_2; | |
__pyx_t_2 = 0; | |
__pyx_v_x_start = __pyx_t_1; | |
__pyx_t_1 = 0; | |
</pre><pre class='cython line score-20' onclick='toggleDiv(this)'>+182: <span class="n">z_step</span><span class="p">,</span> <span class="n">y_step</span><span class="p">,</span> <span class="n">x_step</span> <span class="o">=</span> <span class="n">grid_steps</span></pre> | |
<pre class='cython code score-20'> if (likely(__pyx_v_grid_steps != Py_None)) { | |
PyObject* sequence = __pyx_v_grid_steps; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
Py_ssize_t size = Py_SIZE(sequence); | |
#else | |
Py_ssize_t size = <span class='py_c_api'>PySequence_Size</span>(sequence); | |
#endif | |
if (unlikely(size != 3)) { | |
if (size > 3) <span class='pyx_c_api'>__Pyx_RaiseTooManyValuesError</span>(3); | |
else if (size >= 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(size); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
#if CYTHON_COMPILING_IN_CPYTHON | |
__pyx_t_1 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 0); | |
__pyx_t_2 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 1); | |
__pyx_t_3 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 2); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_3); | |
#else | |
__pyx_t_1 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_t_2 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2); | |
__pyx_t_3 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
#endif | |
} else { | |
<span class='pyx_c_api'>__Pyx_RaiseNoneNotIterableError</span>(); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_v_z_step = __pyx_t_1; | |
__pyx_t_1 = 0; | |
__pyx_v_y_step = __pyx_t_2; | |
__pyx_t_2 = 0; | |
__pyx_v_x_step = __pyx_t_3; | |
__pyx_t_3 = 0; | |
</pre><pre class='cython line score-0'> 183: </pre> | |
<pre class='cython line score-0'> 184: <span class="c"># set attributes</span></pre> | |
<pre class='cython line score-5' onclick='toggleDiv(this)'>+185: <span class="bp">self</span><span class="o">.</span><span class="n">x_step</span> <span class="o">=</span> <span class="n">x_step</span></pre> | |
<pre class='cython code score-5'> __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_x_step);<span class='error_goto'> if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->x_step = __pyx_t_4; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+186: <span class="bp">self</span><span class="o">.</span><span class="n">y_step</span> <span class="o">=</span> <span class="n">y_step</span></pre> | |
<pre class='cython code score-5'> __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_y_step);<span class='error_goto'> if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->y_step = __pyx_t_4; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+187: <span class="bp">self</span><span class="o">.</span><span class="n">z_step</span> <span class="o">=</span> <span class="n">z_step</span></pre> | |
<pre class='cython code score-5'> __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_z_step);<span class='error_goto'> if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->z_step = __pyx_t_4; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+188: <span class="bp">self</span><span class="o">.</span><span class="n">x_start</span> <span class="o">=</span> <span class="n">x_start</span></pre> | |
<pre class='cython code score-5'> __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_x_start);<span class='error_goto'> if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->x_start = __pyx_t_4; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+189: <span class="bp">self</span><span class="o">.</span><span class="n">y_start</span> <span class="o">=</span> <span class="n">y_start</span></pre> | |
<pre class='cython code score-5'> __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_y_start);<span class='error_goto'> if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->y_start = __pyx_t_4; | |
</pre><pre class='cython line score-5' onclick='toggleDiv(this)'>+190: <span class="bp">self</span><span class="o">.</span><span class="n">z_start</span> <span class="o">=</span> <span class="n">z_start</span></pre> | |
<pre class='cython code score-5'> __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_v_z_start);<span class='error_goto'> if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->z_start = __pyx_t_4; | |
</pre><pre class='cython line score-2' onclick='toggleDiv(this)'>+191: <span class="bp">self</span><span class="o">.</span><span class="n">nx</span> <span class="o">=</span> <span class="n">nx</span></pre> | |
<pre class='cython code score-2'> __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(__pyx_v_nx);<span class='error_goto'> if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->nx = __pyx_t_5; | |
</pre><pre class='cython line score-2' onclick='toggleDiv(this)'>+192: <span class="bp">self</span><span class="o">.</span><span class="n">ny</span> <span class="o">=</span> <span class="n">ny</span></pre> | |
<pre class='cython code score-2'> __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(__pyx_v_ny);<span class='error_goto'> if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->ny = __pyx_t_5; | |
</pre><pre class='cython line score-2' onclick='toggleDiv(this)'>+193: <span class="bp">self</span><span class="o">.</span><span class="n">nz</span> <span class="o">=</span> <span class="n">nz</span></pre> | |
<pre class='cython code score-2'> __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(__pyx_v_nz);<span class='error_goto'> if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_v_self->nz = __pyx_t_5; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+194: <span class="bp">self</span><span class="o">.</span><span class="n">nfields</span> <span class="o">=</span> <span class="n">grid_sum</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mf">3</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_v_self->nfields = (__pyx_v_grid_sum.shape[3]); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+195: <span class="bp">self</span><span class="o">.</span><span class="n">grid_sum</span> <span class="o">=</span> <span class="n">grid_sum</span></pre> | |
<pre class='cython code score-0'> __PYX_XDEC_MEMVIEW(&__pyx_v_self->grid_sum, 0); | |
__PYX_INC_MEMVIEW(&__pyx_v_grid_sum, 0); | |
__pyx_v_self->grid_sum = __pyx_v_grid_sum; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+196: <span class="bp">self</span><span class="o">.</span><span class="n">grid_wsum</span> <span class="o">=</span> <span class="n">grid_wsum</span></pre> | |
<pre class='cython code score-0'> __PYX_XDEC_MEMVIEW(&__pyx_v_self->grid_wsum, 0); | |
__PYX_INC_MEMVIEW(&__pyx_v_grid_wsum, 0); | |
__pyx_v_self->grid_wsum = __pyx_v_grid_wsum; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+197: <span class="k">return</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 198: </pre> | |
<pre class='cython line score-0'> 199: <span class="nd">@cython</span><span class="o">.</span><span class="n">boundscheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 200: <span class="nd">@cython</span><span class="o">.</span><span class="n">wraparound</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-34' onclick='toggleDiv(this)'>+201: <span class="k">def</span> <span class="nf">find_roi_for_grid</span><span class="p">(</span></pre> | |
<pre class='cython code score-34'>/* Python wrapper */ | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_3find_roi_for_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_2find_roi_for_grid[] = "\n Fill in the radius of influence for each point in the grid.\n\n Parameters\n ----------\n roi_array : 3D float32 array\n Array which will be filled by the radius of influence for each\n point in the grid.\n roi_func : RoIFunction\n Object whose get_roi method returns the radius of influence.\n\n "; | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_3find_roi_for_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
__Pyx_memviewslice __pyx_v_roi_array = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_v_roi_func = 0; | |
PyObject *__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("find_roi_for_grid (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_roi_array,&__pyx_n_s_roi_func,0}; | |
PyObject* values[2] = {0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_roi_array)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_roi_func)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("find_roi_for_grid", 1, 2, 2, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_roi_for_grid") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 2) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
} | |
__pyx_v_roi_array = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float</span>(values[0]);<span class='error_goto'> if (unlikely(!__pyx_v_roi_array.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_roi_func = ((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *)values[1]); | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("find_roi_for_grid", 1, 2, 2, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.GateToGridMapper.find_roi_for_grid", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return NULL; | |
__pyx_L4_argument_unpacking_done:; | |
if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_roi_func), __pyx_ptype_5pyart_3map_17_gate_to_grid_map_RoIFunction, 1, "roi_func", 0))) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_2find_roi_for_grid(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *)__pyx_v_self), __pyx_v_roi_array, __pyx_v_roi_func); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
goto __pyx_L0; | |
__pyx_L1_error:; | |
__pyx_r = NULL; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static PyObject *__pyx_pf_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_2find_roi_for_grid(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *__pyx_v_self, __Pyx_memviewslice __pyx_v_roi_array, struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_v_roi_func) { | |
int __pyx_v_ix; | |
int __pyx_v_iy; | |
int __pyx_v_iz; | |
float __pyx_v_x; | |
float __pyx_v_y; | |
float __pyx_v_z; | |
float __pyx_v_roi; | |
PyObject *__pyx_r = NULL; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("find_roi_for_grid", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_L0:; | |
__PYX_XDEC_MEMVIEW(&__pyx_v_roi_array, 1); | |
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 202: <span class="bp">self</span><span class="p">,</span> <span class="nb">float</span><span class="p">[:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">roi_array</span><span class="p">,</span> <span class="n">RoIFunction</span> <span class="n">roi_func</span><span class="p">):</span></pre> | |
<pre class='cython line score-0'> 203: <span class="sd">"""</span></pre> | |
<pre class='cython line score-0'> 204: <span class="sd"> Fill in the radius of influence for each point in the grid.</span></pre> | |
<pre class='cython line score-0'> 205: </pre> | |
<pre class='cython line score-0'> 206: <span class="sd"> Parameters</span></pre> | |
<pre class='cython line score-0'> 207: <span class="sd"> ----------</span></pre> | |
<pre class='cython line score-0'> 208: <span class="sd"> roi_array : 3D float32 array</span></pre> | |
<pre class='cython line score-0'> 209: <span class="sd"> Array which will be filled by the radius of influence for each</span></pre> | |
<pre class='cython line score-0'> 210: <span class="sd"> point in the grid.</span></pre> | |
<pre class='cython line score-0'> 211: <span class="sd"> roi_func : RoIFunction</span></pre> | |
<pre class='cython line score-0'> 212: <span class="sd"> Object whose get_roi method returns the radius of influence.</span></pre> | |
<pre class='cython line score-0'> 213: </pre> | |
<pre class='cython line score-0'> 214: <span class="sd"> """</span></pre> | |
<pre class='cython line score-0'> 215: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">ix</span><span class="p">,</span> <span class="nf">iy</span><span class="p">,</span> <span class="nf">iz</span></pre> | |
<pre class='cython line score-0'> 216: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">x</span><span class="p">,</span> <span class="nf">y</span><span class="p">,</span> <span class="nf">z</span><span class="p">,</span> <span class="nf">roi</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+217: <span class="k">for</span> <span class="n">ix</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nx</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = __pyx_v_self->nx; | |
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { | |
__pyx_v_ix = __pyx_t_2; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+218: <span class="k">for</span> <span class="n">iy</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ny</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_3 = __pyx_v_self->ny; | |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { | |
__pyx_v_iy = __pyx_t_4; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+219: <span class="k">for</span> <span class="n">iz</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nz</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_5 = __pyx_v_self->nz; | |
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { | |
__pyx_v_iz = __pyx_t_6; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+220: <span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_start</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_step</span> <span class="o">*</span> <span class="n">ix</span></pre> | |
<pre class='cython code score-0'> __pyx_v_x = (__pyx_v_self->x_start + (__pyx_v_self->x_step * __pyx_v_ix)); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+221: <span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_start</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_step</span> <span class="o">*</span> <span class="n">iy</span></pre> | |
<pre class='cython code score-0'> __pyx_v_y = (__pyx_v_self->y_start + (__pyx_v_self->y_step * __pyx_v_iy)); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+222: <span class="n">z</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_start</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_step</span> <span class="o">*</span> <span class="n">iz</span></pre> | |
<pre class='cython code score-0'> __pyx_v_z = (__pyx_v_self->z_start + (__pyx_v_self->z_step * __pyx_v_iz)); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+223: <span class="n">roi</span> <span class="o">=</span> <span class="n">roi_func</span><span class="o">.</span><span class="n">get_roi</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_roi = ((struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction *)__pyx_v_roi_func->__pyx_vtab)->get_roi(__pyx_v_roi_func, __pyx_v_z, __pyx_v_y, __pyx_v_x, 0); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+224: <span class="n">roi_array</span><span class="p">[</span><span class="n">iz</span><span class="p">,</span> <span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">]</span> <span class="o">=</span> <span class="n">roi</span></pre> | |
<pre class='cython code score-0'> __pyx_t_7 = __pyx_v_iz; | |
__pyx_t_8 = __pyx_v_iy; | |
__pyx_t_9 = __pyx_v_ix; | |
*((float *) ( /* dim=2 */ ((char *) (((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_roi_array.data + __pyx_t_7 * __pyx_v_roi_array.strides[0]) ) + __pyx_t_8 * __pyx_v_roi_array.strides[1]) )) + __pyx_t_9)) )) = __pyx_v_roi; | |
} | |
} | |
} | |
</pre><pre class='cython line score-2' onclick='toggleDiv(this)'>+225: <span class="k">return</span></pre> | |
<pre class='cython code score-2'> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r); | |
__pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 226: </pre> | |
<pre class='cython line score-0'> 227: <span class="nd">@cython</span><span class="o">.</span><span class="n">cdivision</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 228: <span class="nd">@cython</span><span class="o">.</span><span class="n">boundscheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 229: <span class="nd">@cython</span><span class="o">.</span><span class="n">wraparound</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-144' onclick='toggleDiv(this)'>+230: <span class="k">def</span> <span class="nf">map_gates_to_grid</span><span class="p">(</span></pre> | |
<pre class='cython code score-144'>/* Python wrapper */ | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_5map_gates_to_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ | |
static char __pyx_doc_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_4map_gates_to_grid[] = "\n Map radar gates unto the regular grid.\n\n The grid_sum and grid_wsum arrays used to initalize the class\n are update with the mapped gate data.\n\n Parameters\n ----------\n elevations, azimuths : 1D float32 array\n Elevation and azimuth angles in degrees for each ray in the radar.\n ranges : 1D float32 array\n Gate ranges in meters for each bin in the radar.\n field_data : 3D float32 array\n Array containing field data for the radar, dimension are ordered\n as nrays, ngates, nfields.\n field_mask : 3D uint8 array\n Array containing masking of the field data for the radar,\n dimension are ordered as nrays, ngates, nfields.\n offset : tuple of floats\n Offset of the radar from the grid origin. Dimension are ordered\n as z, y, x.\n toa : float\n Top of atmosphere. Gates above this level are considered.\n roi_func : RoIFunction\n Object whose get_roi method returns the radius of influence.\n filter_flag : int\n True to filter gates, removing those with reflectivity greater\n than max_refl or non-finite values. False performs no reflectivity\n based filtering.\n max_refl : float\n Maximum valid reflectivity, not used if filter_flag is False.\n weighting_function : int\n Function to use for weighting gates based upon distance.\n 0 for Barnes, 1 for Cressman weighting.\n\n "; | |
static PyObject *__pyx_pw_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_5map_gates_to_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { | |
__Pyx_memviewslice __pyx_v_elevations = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
__Pyx_memviewslice __pyx_v_azimuths = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
__Pyx_memviewslice __pyx_v_ranges = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
__Pyx_memviewslice __pyx_v_field_data = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
__Pyx_memviewslice __pyx_v_field_mask = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
PyObject *__pyx_v_offset = 0; | |
float __pyx_v_toa; | |
struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_v_roi_func = 0; | |
int __pyx_v_filter_flag; | |
float __pyx_v_max_refl; | |
int __pyx_v_weighting_function; | |
PyObject *__pyx_r = 0; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("map_gates_to_grid (wrapper)", 0); | |
{ | |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elevations,&__pyx_n_s_azimuths,&__pyx_n_s_ranges,&__pyx_n_s_field_data,&__pyx_n_s_field_mask,&__pyx_n_s_offset,&__pyx_n_s_toa,&__pyx_n_s_roi_func,&__pyx_n_s_filter_flag,&__pyx_n_s_max_refl,&__pyx_n_s_weighting_function,0}; | |
PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; | |
if (unlikely(__pyx_kwds)) { | |
Py_ssize_t kw_args; | |
const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args); | |
switch (pos_args) { | |
case 11: values[10] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 10); | |
case 10: values[9] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 9); | |
case 9: values[8] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 8); | |
case 8: values[7] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 7); | |
case 7: values[6] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 6); | |
case 6: values[5] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 5); | |
case 5: values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4); | |
case 4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
case 0: break; | |
default: goto __pyx_L5_argtuple_error; | |
} | |
kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds); | |
switch (pos_args) { | |
case 0: | |
if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_elevations)) != 0)) kw_args--; | |
else goto __pyx_L5_argtuple_error; | |
case 1: | |
if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_azimuths)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 1); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 2: | |
if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_ranges)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 2); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 3: | |
if (likely((values[3] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_field_data)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 3); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 4: | |
if (likely((values[4] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_field_mask)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 4); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 5: | |
if (likely((values[5] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 5); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 6: | |
if (likely((values[6] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_toa)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 6); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 7: | |
if (likely((values[7] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_roi_func)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 7); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 8: | |
if (likely((values[8] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_filter_flag)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 8); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 9: | |
if (likely((values[9] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_max_refl)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 9); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
case 10: | |
if (likely((values[10] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_weighting_function)) != 0)) kw_args--; | |
else { | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, 10); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} | |
if (unlikely(kw_args > 0)) { | |
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "map_gates_to_grid") < 0)) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
} else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 11) { | |
goto __pyx_L5_argtuple_error; | |
} else { | |
values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0); | |
values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1); | |
values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2); | |
values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3); | |
values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4); | |
values[5] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 5); | |
values[6] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 6); | |
values[7] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 7); | |
values[8] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 8); | |
values[9] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 9); | |
values[10] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 10); | |
} | |
__pyx_v_elevations = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_dc_float</span>(values[0]);<span class='error_goto'> if (unlikely(!__pyx_v_elevations.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_azimuths = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_dc_float</span>(values[1]);<span class='error_goto'> if (unlikely(!__pyx_v_azimuths.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_ranges = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_dc_float</span>(values[2]);<span class='error_goto'> if (unlikely(!__pyx_v_ranges.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_field_data = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_d_d_dc_float</span>(values[3]);<span class='error_goto'> if (unlikely(!__pyx_v_field_data.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_field_mask = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_d_d_dc_char</span>(values[4]);<span class='error_goto'> if (unlikely(!__pyx_v_field_mask.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_offset = values[5]; | |
__pyx_v_toa = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[6]);<span class='error_goto'> if (unlikely((__pyx_v_toa == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_roi_func = ((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *)values[7]); | |
__pyx_v_filter_flag = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[8]);<span class='error_goto'> if (unlikely((__pyx_v_filter_flag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_max_refl = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(values[9]);<span class='error_goto'> if (unlikely((__pyx_v_max_refl == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_v_weighting_function = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[10]);<span class='error_goto'> if (unlikely((__pyx_v_weighting_function == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
} | |
goto __pyx_L4_argument_unpacking_done; | |
__pyx_L5_argtuple_error:; | |
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("map_gates_to_grid", 1, 11, 11, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span> | |
__pyx_L3_error:; | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.GateToGridMapper.map_gates_to_grid", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return NULL; | |
__pyx_L4_argument_unpacking_done:; | |
if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_roi_func), __pyx_ptype_5pyart_3map_17_gate_to_grid_map_RoIFunction, 1, "roi_func", 0))) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_r = __pyx_pf_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_4map_gates_to_grid(((struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *)__pyx_v_self), __pyx_v_elevations, __pyx_v_azimuths, __pyx_v_ranges, __pyx_v_field_data, __pyx_v_field_mask, __pyx_v_offset, __pyx_v_toa, __pyx_v_roi_func, __pyx_v_filter_flag, __pyx_v_max_refl, __pyx_v_weighting_function); | |
int __pyx_lineno = 0; | |
const char *__pyx_filename = NULL; | |
int __pyx_clineno = 0; | |
/* function exit code */ | |
goto __pyx_L0; | |
__pyx_L1_error:; | |
__pyx_r = NULL; | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
static PyObject *__pyx_pf_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_4map_gates_to_grid(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *__pyx_v_self, __Pyx_memviewslice __pyx_v_elevations, __Pyx_memviewslice __pyx_v_azimuths, __Pyx_memviewslice __pyx_v_ranges, __Pyx_memviewslice __pyx_v_field_data, __Pyx_memviewslice __pyx_v_field_mask, PyObject *__pyx_v_offset, float __pyx_v_toa, struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_RoIFunction *__pyx_v_roi_func, int __pyx_v_filter_flag, float __pyx_v_max_refl, int __pyx_v_weighting_function) { | |
int __pyx_v_nrays; | |
int __pyx_v_ngates; | |
float __pyx_v_elevation; | |
float __pyx_v_azimuth; | |
float __pyx_v_r; | |
float __pyx_v_s; | |
float __pyx_v_value; | |
float __pyx_v_roi; | |
__Pyx_memviewslice __pyx_v_values = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
__Pyx_memviewslice __pyx_v_masks = { 0, 0, { 0 }, { 0 }, { 0 } }; | |
float __pyx_v_x; | |
float __pyx_v_y; | |
float __pyx_v_z; | |
float __pyx_v_x_offset; | |
float __pyx_v_y_offset; | |
float __pyx_v_z_offset; | |
int __pyx_v_nray; | |
int __pyx_v_ngate; | |
PyObject *__pyx_r = NULL; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("map_gates_to_grid", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); | |
goto __pyx_L0; | |
__pyx_L1_error:; | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); | |
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); | |
__PYX_XDEC_MEMVIEW(&__pyx_t_23, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_t_25, 1); | |
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("pyart.map._gate_to_grid_map.GateToGridMapper.map_gates_to_grid", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
__pyx_r = NULL; | |
__pyx_L0:; | |
__PYX_XDEC_MEMVIEW(&__pyx_v_values, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_masks, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_elevations, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_azimuths, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_ranges, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_field_data, 1); | |
__PYX_XDEC_MEMVIEW(&__pyx_v_field_mask, 1); | |
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r); | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 231: <span class="bp">self</span><span class="p">,</span> <span class="nb">float</span><span class="p">[::</span><span class="mf">1</span><span class="p">]</span> <span class="n">elevations</span><span class="p">,</span> <span class="nb">float</span><span class="p">[::</span><span class="mf">1</span><span class="p">]</span> <span class="n">azimuths</span><span class="p">,</span></pre> | |
<pre class='cython line score-0'> 232: <span class="nb">float</span><span class="p">[::</span><span class="mf">1</span><span class="p">]</span> <span class="n">ranges</span><span class="p">,</span> <span class="nb">float</span><span class="p">[:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">field_data</span><span class="p">,</span></pre> | |
<pre class='cython line score-0'> 233: <span class="n">char</span><span class="p">[:,</span> <span class="p">:,</span> <span class="p">::</span><span class="mf">1</span><span class="p">]</span> <span class="n">field_mask</span><span class="p">,</span> <span class="n">offset</span><span class="p">,</span> <span class="nb">float</span> <span class="n">toa</span><span class="p">,</span></pre> | |
<pre class='cython line score-0'> 234: <span class="n">RoIFunction</span> <span class="n">roi_func</span><span class="p">,</span> <span class="nb">int</span> <span class="n">filter_flag</span><span class="p">,</span> <span class="nb">float</span> <span class="n">max_refl</span><span class="p">,</span></pre> | |
<pre class='cython line score-0'> 235: <span class="nb">int</span> <span class="n">weighting_function</span><span class="p">):</span></pre> | |
<pre class='cython line score-0'> 236: <span class="sd">"""</span></pre> | |
<pre class='cython line score-0'> 237: <span class="sd"> Map radar gates unto the regular grid.</span></pre> | |
<pre class='cython line score-0'> 238: </pre> | |
<pre class='cython line score-0'> 239: <span class="sd"> The grid_sum and grid_wsum arrays used to initalize the class</span></pre> | |
<pre class='cython line score-0'> 240: <span class="sd"> are update with the mapped gate data.</span></pre> | |
<pre class='cython line score-0'> 241: </pre> | |
<pre class='cython line score-0'> 242: <span class="sd"> Parameters</span></pre> | |
<pre class='cython line score-0'> 243: <span class="sd"> ----------</span></pre> | |
<pre class='cython line score-0'> 244: <span class="sd"> elevations, azimuths : 1D float32 array</span></pre> | |
<pre class='cython line score-0'> 245: <span class="sd"> Elevation and azimuth angles in degrees for each ray in the radar.</span></pre> | |
<pre class='cython line score-0'> 246: <span class="sd"> ranges : 1D float32 array</span></pre> | |
<pre class='cython line score-0'> 247: <span class="sd"> Gate ranges in meters for each bin in the radar.</span></pre> | |
<pre class='cython line score-0'> 248: <span class="sd"> field_data : 3D float32 array</span></pre> | |
<pre class='cython line score-0'> 249: <span class="sd"> Array containing field data for the radar, dimension are ordered</span></pre> | |
<pre class='cython line score-0'> 250: <span class="sd"> as nrays, ngates, nfields.</span></pre> | |
<pre class='cython line score-0'> 251: <span class="sd"> field_mask : 3D uint8 array</span></pre> | |
<pre class='cython line score-0'> 252: <span class="sd"> Array containing masking of the field data for the radar,</span></pre> | |
<pre class='cython line score-0'> 253: <span class="sd"> dimension are ordered as nrays, ngates, nfields.</span></pre> | |
<pre class='cython line score-0'> 254: <span class="sd"> offset : tuple of floats</span></pre> | |
<pre class='cython line score-0'> 255: <span class="sd"> Offset of the radar from the grid origin. Dimension are ordered</span></pre> | |
<pre class='cython line score-0'> 256: <span class="sd"> as z, y, x.</span></pre> | |
<pre class='cython line score-0'> 257: <span class="sd"> toa : float</span></pre> | |
<pre class='cython line score-0'> 258: <span class="sd"> Top of atmosphere. Gates above this level are considered.</span></pre> | |
<pre class='cython line score-0'> 259: <span class="sd"> roi_func : RoIFunction</span></pre> | |
<pre class='cython line score-0'> 260: <span class="sd"> Object whose get_roi method returns the radius of influence.</span></pre> | |
<pre class='cython line score-0'> 261: <span class="sd"> filter_flag : int</span></pre> | |
<pre class='cython line score-0'> 262: <span class="sd"> True to filter gates, removing those with reflectivity greater</span></pre> | |
<pre class='cython line score-0'> 263: <span class="sd"> than max_refl or non-finite values. False performs no reflectivity</span></pre> | |
<pre class='cython line score-0'> 264: <span class="sd"> based filtering.</span></pre> | |
<pre class='cython line score-0'> 265: <span class="sd"> max_refl : float</span></pre> | |
<pre class='cython line score-0'> 266: <span class="sd"> Maximum valid reflectivity, not used if filter_flag is False.</span></pre> | |
<pre class='cython line score-0'> 267: <span class="sd"> weighting_function : int</span></pre> | |
<pre class='cython line score-0'> 268: <span class="sd"> Function to use for weighting gates based upon distance.</span></pre> | |
<pre class='cython line score-0'> 269: <span class="sd"> 0 for Barnes, 1 for Cressman weighting.</span></pre> | |
<pre class='cython line score-0'> 270: </pre> | |
<pre class='cython line score-0'> 271: <span class="sd"> """</span></pre> | |
<pre class='cython line score-0'> 272: </pre> | |
<pre class='cython line score-0'> 273: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">nrays</span><span class="p">,</span> <span class="nf">ngates</span></pre> | |
<pre class='cython line score-0'> 274: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">elevation</span><span class="p">,</span> <span class="nf">azimuth</span><span class="p">,</span> <span class="nf">r</span><span class="p">,</span> <span class="nf">s</span></pre> | |
<pre class='cython line score-0'> 275: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">value</span><span class="p">,</span> <span class="nf">roi</span></pre> | |
<pre class='cython line score-0'> 276: <span class="k">cdef</span> <span class="kt">float</span>[<span class="p">:]</span> <span class="n">values</span></pre> | |
<pre class='cython line score-0'> 277: <span class="k">cdef</span> <span class="kt">char</span>[<span class="p">:]</span> <span class="n">masks</span></pre> | |
<pre class='cython line score-0'> 278: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">x</span><span class="p">,</span> <span class="nf">y</span><span class="p">,</span> <span class="nf">z</span></pre> | |
<pre class='cython line score-0'> 279: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">x_offset</span><span class="p">,</span> <span class="nf">y_offset</span><span class="p">,</span> <span class="nf">z_offset</span></pre> | |
<pre class='cython line score-0'> 280: </pre> | |
<pre class='cython line score-6' onclick='toggleDiv(this)'>+281: <span class="n">nrays</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">elevations</span><span class="p">)</span></pre> | |
<pre class='cython code score-6'> __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_elevations, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);;<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_t_2 = <span class='py_c_api'>PyObject_Length</span>(__pyx_t_1);<span class='error_goto'> if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
__pyx_v_nrays = __pyx_t_2; | |
</pre><pre class='cython line score-6' onclick='toggleDiv(this)'>+282: <span class="n">ngates</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ranges</span><span class="p">)</span></pre> | |
<pre class='cython code score-6'> __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_ranges, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);;<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_t_2 = <span class='py_c_api'>PyObject_Length</span>(__pyx_t_1);<span class='error_goto'> if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
__pyx_v_ngates = __pyx_t_2; | |
</pre><pre class='cython line score-67' onclick='toggleDiv(this)'>+283: <span class="n">z_offset</span><span class="p">,</span> <span class="n">y_offset</span><span class="p">,</span> <span class="n">x_offset</span> <span class="o">=</span> <span class="n">offset</span></pre> | |
<pre class='cython code score-67'> if ((likely(<span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_v_offset))) || (<span class='py_c_api'>PyList_CheckExact</span>(__pyx_v_offset))) { | |
PyObject* sequence = __pyx_v_offset; | |
#if CYTHON_COMPILING_IN_CPYTHON | |
Py_ssize_t size = Py_SIZE(sequence); | |
#else | |
Py_ssize_t size = <span class='py_c_api'>PySequence_Size</span>(sequence); | |
#endif | |
if (unlikely(size != 3)) { | |
if (size > 3) <span class='pyx_c_api'>__Pyx_RaiseTooManyValuesError</span>(3); | |
else if (size >= 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(size); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
#if CYTHON_COMPILING_IN_CPYTHON | |
if (likely(<span class='py_c_api'>PyTuple_CheckExact</span>(sequence))) { | |
__pyx_t_1 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 0); | |
__pyx_t_3 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 1); | |
__pyx_t_4 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(sequence, 2); | |
} else { | |
__pyx_t_1 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 0); | |
__pyx_t_3 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 1); | |
__pyx_t_4 = <span class='py_macro_api'>PyList_GET_ITEM</span>(sequence, 2); | |
} | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_3); | |
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4); | |
#else | |
__pyx_t_1 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
__pyx_t_3 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
__pyx_t_4 = <span class='py_macro_api'>PySequence_ITEM</span>(sequence, 2);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
#endif | |
} else { | |
Py_ssize_t index = -1; | |
__pyx_t_5 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_v_offset);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5); | |
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; | |
index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1); | |
index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3); | |
index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; | |
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4); | |
if (<span class='pyx_c_api'>__Pyx_IternextUnpackEndCheck</span>(__pyx_t_6(__pyx_t_5), 3) < 0) <span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_t_6 = NULL; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0; | |
goto __pyx_L4_unpacking_done; | |
__pyx_L3_unpacking_failed:; | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0; | |
__pyx_t_6 = NULL; | |
if (<span class='pyx_c_api'>__Pyx_IterFinish</span>() == 0) <span class='pyx_c_api'>__Pyx_RaiseNeedMoreValuesError</span>(index); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
__pyx_L4_unpacking_done:; | |
} | |
__pyx_t_7 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_1);<span class='error_goto'> if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0; | |
__pyx_t_8 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_3);<span class='error_goto'> if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0; | |
__pyx_t_9 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_4);<span class='error_goto'> if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0; | |
__pyx_v_z_offset = __pyx_t_7; | |
__pyx_v_y_offset = __pyx_t_8; | |
__pyx_v_x_offset = __pyx_t_9; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+284: <span class="k">for</span> <span class="n">nray</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nrays</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_10 = __pyx_v_nrays; | |
for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { | |
__pyx_v_nray = __pyx_t_11; | |
</pre><pre class='cython line score-0'> 285: <span class="c"># elevation and azimuth angles in radians</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+286: <span class="n">elevation</span> <span class="o">=</span> <span class="n">elevations</span><span class="p">[</span><span class="n">nray</span><span class="p">]</span> <span class="o">*</span> <span class="n">PI</span> <span class="o">/</span> <span class="mf">180.0</span></pre> | |
<pre class='cython code score-0'> __pyx_t_12 = __pyx_v_nray; | |
__pyx_v_elevation = (((*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_elevations.data) + __pyx_t_12)) ))) * __pyx_v_5pyart_3map_17_gate_to_grid_map_PI) / 180.0); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+287: <span class="n">azimuth</span> <span class="o">=</span> <span class="n">azimuths</span><span class="p">[</span><span class="n">nray</span><span class="p">]</span> <span class="o">*</span> <span class="n">PI</span> <span class="o">/</span> <span class="mf">180.0</span></pre> | |
<pre class='cython code score-0'> __pyx_t_13 = __pyx_v_nray; | |
__pyx_v_azimuth = (((*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_azimuths.data) + __pyx_t_13)) ))) * __pyx_v_5pyart_3map_17_gate_to_grid_map_PI) / 180.0); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+288: <span class="k">for</span> <span class="n">ngate</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">ngates</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_14 = __pyx_v_ngates; | |
for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { | |
__pyx_v_ngate = __pyx_t_15; | |
</pre><pre class='cython line score-0'> 289: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+290: <span class="k">if</span> <span class="n">field_mask</span><span class="p">[</span><span class="n">nray</span><span class="p">,</span> <span class="n">ngate</span><span class="p">,</span> <span class="mf">0</span><span class="p">]:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_16 = __pyx_v_nray; | |
__pyx_t_17 = __pyx_v_ngate; | |
__pyx_t_2 = 0; | |
__pyx_t_18 = ((*((char *) ( /* dim=2 */ ((char *) (((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_field_mask.data + __pyx_t_16 * __pyx_v_field_mask.strides[0]) ) + __pyx_t_17 * __pyx_v_field_mask.strides[1]) )) + __pyx_t_2)) ))) != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+291: <span class="k">continue</span></pre> | |
<pre class='cython code score-0'> goto __pyx_L7_continue; | |
} | |
</pre><pre class='cython line score-0'> 292: </pre> | |
<pre class='cython line score-0'> 293: <span class="c"># calculate cartesian coordinate assuming 4/3 earth radius</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+294: <span class="n">r</span> <span class="o">=</span> <span class="n">ranges</span><span class="p">[</span><span class="n">ngate</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_19 = __pyx_v_ngate; | |
__pyx_v_r = (*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_ranges.data) + __pyx_t_19)) ))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+295: <span class="n">z</span> <span class="o">=</span> <span class="p">(</span><span class="n">r</span><span class="o">**</span><span class="mf">2</span> <span class="o">+</span> <span class="n">R</span><span class="o">**</span><span class="mf">2</span> <span class="o">+</span> <span class="mf">2.0</span><span class="o">*</span><span class="n">r</span><span class="o">*</span><span class="n">R</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">elevation</span><span class="p">))</span><span class="o">**</span><span class="mf">0.5</span> <span class="o">-</span> <span class="n">R</span></pre> | |
<pre class='cython code score-0'> __pyx_v_z = (pow(((powf(__pyx_v_r, 2.0) + powf(__pyx_v_5pyart_3map_17_gate_to_grid_map_R, 2.0)) + (((2.0 * __pyx_v_r) * __pyx_v_5pyart_3map_17_gate_to_grid_map_R) * sin(__pyx_v_elevation))), 0.5) - __pyx_v_5pyart_3map_17_gate_to_grid_map_R); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+296: <span class="k">if</span> <span class="n">z</span> <span class="o">+</span> <span class="n">z_offset</span> <span class="o">>=</span> <span class="n">toa</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_18 = (((__pyx_v_z + __pyx_v_z_offset) >= __pyx_v_toa) != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+297: <span class="k">continue</span> <span class="c"># above top of atmosphere</span></pre> | |
<pre class='cython code score-0'> goto __pyx_L7_continue; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+298: <span class="n">s</span> <span class="o">=</span> <span class="n">R</span> <span class="o">*</span> <span class="n">asin</span><span class="p">(</span><span class="n">r</span> <span class="o">*</span> <span class="n">cos</span><span class="p">(</span><span class="n">elevation</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">R</span> <span class="o">+</span> <span class="n">z</span><span class="p">))</span> <span class="c"># arc length in m.</span></pre> | |
<pre class='cython code score-0'> __pyx_v_s = (__pyx_v_5pyart_3map_17_gate_to_grid_map_R * asin(((__pyx_v_r * cos(__pyx_v_elevation)) / (__pyx_v_5pyart_3map_17_gate_to_grid_map_R + __pyx_v_z)))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+299: <span class="n">x</span> <span class="o">=</span> <span class="n">s</span> <span class="o">*</span> <span class="n">sin</span><span class="p">(</span><span class="n">azimuth</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_x = (__pyx_v_s * sin(__pyx_v_azimuth)); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+300: <span class="n">y</span> <span class="o">=</span> <span class="n">s</span> <span class="o">*</span> <span class="n">cos</span><span class="p">(</span><span class="n">azimuth</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_y = (__pyx_v_s * cos(__pyx_v_azimuth)); | |
</pre><pre class='cython line score-0'> 301: </pre> | |
<pre class='cython line score-0'> 302: <span class="c"># add offsets</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+303: <span class="n">x</span> <span class="o">+=</span> <span class="n">x_offset</span></pre> | |
<pre class='cython code score-0'> __pyx_v_x = (__pyx_v_x + __pyx_v_x_offset); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+304: <span class="n">y</span> <span class="o">+=</span> <span class="n">y_offset</span></pre> | |
<pre class='cython code score-0'> __pyx_v_y = (__pyx_v_y + __pyx_v_y_offset); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+305: <span class="n">z</span> <span class="o">+=</span> <span class="n">z_offset</span></pre> | |
<pre class='cython code score-0'> __pyx_v_z = (__pyx_v_z + __pyx_v_z_offset); | |
</pre><pre class='cython line score-0'> 306: </pre> | |
<pre class='cython line score-0'> 307: <span class="c"># Region of influence</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+308: <span class="n">roi</span> <span class="o">=</span> <span class="n">roi_func</span><span class="o">.</span><span class="n">get_roi</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_roi = ((struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_RoIFunction *)__pyx_v_roi_func->__pyx_vtab)->get_roi(__pyx_v_roi_func, __pyx_v_z, __pyx_v_y, __pyx_v_x, 0); | |
</pre><pre class='cython line score-0'> 309: </pre> | |
<pre class='cython line score-0'> 310: <span class="c"># reflectivity filtering for non-finite and large values</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+311: <span class="k">if</span> <span class="n">filter_flag</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_18 = (__pyx_v_filter_flag != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+312: <span class="n">value</span> <span class="o">=</span> <span class="n">field_data</span><span class="p">[</span><span class="n">nray</span><span class="p">,</span> <span class="n">ngate</span><span class="p">,</span> <span class="mf">0</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_20 = __pyx_v_nray; | |
__pyx_t_21 = __pyx_v_ngate; | |
__pyx_t_22 = 0; | |
__pyx_v_value = (*((float *) ( /* dim=2 */ ((char *) (((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_field_data.data + __pyx_t_20 * __pyx_v_field_data.strides[0]) ) + __pyx_t_21 * __pyx_v_field_data.strides[1]) )) + __pyx_t_22)) ))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+313: <span class="k">if</span> <span class="ow">not</span> <span class="n">isfinite</span><span class="p">(</span><span class="n">value</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_18 = ((!(isfinite(__pyx_v_value) != 0)) != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+314: <span class="k">continue</span></pre> | |
<pre class='cython code score-0'> goto __pyx_L7_continue; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+315: <span class="k">if</span> <span class="n">value</span> <span class="o">></span> <span class="n">max_refl</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_18 = ((__pyx_v_value > __pyx_v_max_refl) != 0); | |
if (__pyx_t_18) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+316: <span class="k">continue</span></pre> | |
<pre class='cython code score-0'> goto __pyx_L7_continue; | |
} | |
goto __pyx_L11; | |
} | |
__pyx_L11:; | |
</pre><pre class='cython line score-0'> 317: </pre> | |
<pre class='cython line score-10' onclick='toggleDiv(this)'>+318: <span class="n">values</span> <span class="o">=</span> <span class="n">field_data</span><span class="p">[</span><span class="n">nray</span><span class="p">,</span> <span class="n">ngate</span><span class="p">]</span></pre> | |
<pre class='cython code score-10'> __pyx_t_24 = -1; | |
__pyx_t_23.data = __pyx_v_field_data.data; | |
__pyx_t_23.memview = __pyx_v_field_data.memview; | |
__PYX_INC_MEMVIEW(&__pyx_t_23, 0); | |
{ | |
Py_ssize_t __pyx_tmp_idx = __pyx_v_nray; | |
Py_ssize_t __pyx_tmp_shape = __pyx_v_field_data.shape[0]; | |
Py_ssize_t __pyx_tmp_stride = __pyx_v_field_data.strides[0]; | |
if (0 && (__pyx_tmp_idx < 0)) | |
__pyx_tmp_idx += __pyx_tmp_shape; | |
if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) { | |
<span class='py_c_api'>PyErr_SetString</span>(PyExc_IndexError, "Index out of bounds (axis 0)"); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_t_23.data += __pyx_tmp_idx * __pyx_tmp_stride; | |
} | |
{ | |
Py_ssize_t __pyx_tmp_idx = __pyx_v_ngate; | |
Py_ssize_t __pyx_tmp_shape = __pyx_v_field_data.shape[1]; | |
Py_ssize_t __pyx_tmp_stride = __pyx_v_field_data.strides[1]; | |
if (0 && (__pyx_tmp_idx < 0)) | |
__pyx_tmp_idx += __pyx_tmp_shape; | |
if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) { | |
<span class='py_c_api'>PyErr_SetString</span>(PyExc_IndexError, "Index out of bounds (axis 1)"); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_t_23.data += __pyx_tmp_idx * __pyx_tmp_stride; | |
} | |
__pyx_t_23.shape[0] = __pyx_v_field_data.shape[2]; | |
__pyx_t_23.strides[0] = __pyx_v_field_data.strides[2]; | |
__pyx_t_23.suboffsets[0] = -1; | |
__PYX_XDEC_MEMVIEW(&__pyx_v_values, 1); | |
__pyx_v_values = __pyx_t_23; | |
__pyx_t_23.memview = NULL; | |
__pyx_t_23.data = NULL; | |
</pre><pre class='cython line score-10' onclick='toggleDiv(this)'>+319: <span class="n">masks</span> <span class="o">=</span> <span class="n">field_mask</span><span class="p">[</span><span class="n">nray</span><span class="p">,</span> <span class="n">ngate</span><span class="p">]</span></pre> | |
<pre class='cython code score-10'> __pyx_t_24 = -1; | |
__pyx_t_25.data = __pyx_v_field_mask.data; | |
__pyx_t_25.memview = __pyx_v_field_mask.memview; | |
__PYX_INC_MEMVIEW(&__pyx_t_25, 0); | |
{ | |
Py_ssize_t __pyx_tmp_idx = __pyx_v_nray; | |
Py_ssize_t __pyx_tmp_shape = __pyx_v_field_mask.shape[0]; | |
Py_ssize_t __pyx_tmp_stride = __pyx_v_field_mask.strides[0]; | |
if (0 && (__pyx_tmp_idx < 0)) | |
__pyx_tmp_idx += __pyx_tmp_shape; | |
if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) { | |
<span class='py_c_api'>PyErr_SetString</span>(PyExc_IndexError, "Index out of bounds (axis 0)"); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride; | |
} | |
{ | |
Py_ssize_t __pyx_tmp_idx = __pyx_v_ngate; | |
Py_ssize_t __pyx_tmp_shape = __pyx_v_field_mask.shape[1]; | |
Py_ssize_t __pyx_tmp_stride = __pyx_v_field_mask.strides[1]; | |
if (0 && (__pyx_tmp_idx < 0)) | |
__pyx_tmp_idx += __pyx_tmp_shape; | |
if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) { | |
<span class='py_c_api'>PyErr_SetString</span>(PyExc_IndexError, "Index out of bounds (axis 1)"); | |
<span class='error_goto'>{__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span> | |
} | |
__pyx_t_25.data += __pyx_tmp_idx * __pyx_tmp_stride; | |
} | |
__pyx_t_25.shape[0] = __pyx_v_field_mask.shape[2]; | |
__pyx_t_25.strides[0] = __pyx_v_field_mask.strides[2]; | |
__pyx_t_25.suboffsets[0] = -1; | |
__PYX_XDEC_MEMVIEW(&__pyx_v_masks, 1); | |
__pyx_v_masks = __pyx_t_25; | |
__pyx_t_25.memview = NULL; | |
__pyx_t_25.data = NULL; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+320: <span class="bp">self</span><span class="o">.</span><span class="n">map_gate</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="n">values</span><span class="p">,</span> <span class="n">masks</span><span class="p">,</span> <span class="n">weighting_function</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> ((struct __pyx_vtabstruct_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *)__pyx_v_self->__pyx_vtab)->map_gate(__pyx_v_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_roi, __pyx_v_values, __pyx_v_masks, __pyx_v_weighting_function); | |
__pyx_L7_continue:; | |
} | |
} | |
</pre><pre class='cython line score-0'> 321: </pre> | |
<pre class='cython line score-0'> 322: <span class="nd">@cython</span><span class="o">.</span><span class="n">initializedcheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 323: <span class="nd">@cython</span><span class="o">.</span><span class="n">cdivision</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 324: <span class="nd">@cython</span><span class="o">.</span><span class="n">boundscheck</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0'> 325: <span class="nd">@cython</span><span class="o">.</span><span class="n">wraparound</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+326: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">map_gate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">float</span> <span class="n">x</span><span class="p">,</span> <span class="nb">float</span> <span class="n">y</span><span class="p">,</span> <span class="nb">float</span> <span class="n">z</span><span class="p">,</span> <span class="nb">float</span> <span class="n">roi</span><span class="p">,</span></pre> | |
<pre class='cython code score-0'>static int __pyx_f_5pyart_3map_17_gate_to_grid_map_16GateToGridMapper_map_gate(struct __pyx_obj_5pyart_3map_17_gate_to_grid_map_GateToGridMapper *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_roi, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_masks, int __pyx_v_weighting_function) { | |
float __pyx_v_xg; | |
float __pyx_v_yg; | |
float __pyx_v_zg; | |
float __pyx_v_weight; | |
float __pyx_v_roi2; | |
float __pyx_v_dist2; | |
int __pyx_v_x_min; | |
int __pyx_v_x_max; | |
int __pyx_v_y_min; | |
int __pyx_v_y_max; | |
int __pyx_v_z_min; | |
int __pyx_v_z_max; | |
int __pyx_v_xi; | |
int __pyx_v_yi; | |
int __pyx_v_zi; | |
int __pyx_v_i; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("map_gate", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 327: <span class="nb">float</span><span class="p">[:]</span> <span class="n">values</span><span class="p">,</span> <span class="n">char</span><span class="p">[:]</span> <span class="n">masks</span><span class="p">,</span></pre> | |
<pre class='cython line score-0'> 328: <span class="nb">int</span> <span class="n">weighting_function</span><span class="p">):</span></pre> | |
<pre class='cython line score-0'> 329: <span class="sd">""" Map a single gate to the grid. """</span></pre> | |
<pre class='cython line score-0'> 330: </pre> | |
<pre class='cython line score-0'> 331: <span class="k">cdef</span> <span class="kt">float</span> <span class="nf">xg</span><span class="p">,</span> <span class="nf">yg</span><span class="p">,</span> <span class="nf">zg</span><span class="p">,</span> <span class="nf">dist</span><span class="p">,</span> <span class="nf">weight</span><span class="p">,</span> <span class="nf">roi2</span><span class="p">,</span> <span class="nf">dist2</span></pre> | |
<pre class='cython line score-0'> 332: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">x_min</span><span class="p">,</span> <span class="nf">x_max</span><span class="p">,</span> <span class="nf">y_min</span><span class="p">,</span> <span class="nf">y_max</span><span class="p">,</span> <span class="nf">z_min</span><span class="p">,</span> <span class="nf">z_max</span></pre> | |
<pre class='cython line score-0'> 333: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">xi</span><span class="p">,</span> <span class="nf">yi</span><span class="p">,</span> <span class="nf">zi</span></pre> | |
<pre class='cython line score-0'> 334: </pre> | |
<pre class='cython line score-0'> 335: <span class="c"># shift positions so that grid starts at 0</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+336: <span class="n">x</span> <span class="o">-=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_start</span></pre> | |
<pre class='cython code score-0'> __pyx_v_x = (__pyx_v_x - __pyx_v_self->x_start); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+337: <span class="n">y</span> <span class="o">-=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_start</span></pre> | |
<pre class='cython code score-0'> __pyx_v_y = (__pyx_v_y - __pyx_v_self->y_start); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+338: <span class="n">z</span> <span class="o">-=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_start</span></pre> | |
<pre class='cython code score-0'> __pyx_v_z = (__pyx_v_z - __pyx_v_self->z_start); | |
</pre><pre class='cython line score-0'> 339: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+340: <span class="n">x_min</span> <span class="o">=</span> <span class="n">find_min</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_step</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_x_min = __pyx_f_5pyart_3map_17_gate_to_grid_map_find_min(__pyx_v_x, __pyx_v_roi, __pyx_v_self->x_step); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+341: <span class="k">if</span> <span class="n">x_min</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">nx</span><span class="o">-</span><span class="mf">1</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_x_min > (__pyx_v_self->nx - 1)) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+342: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+343: <span class="n">x_max</span> <span class="o">=</span> <span class="n">find_max</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_step</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nx</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_x_max = __pyx_f_5pyart_3map_17_gate_to_grid_map_find_max(__pyx_v_x, __pyx_v_roi, __pyx_v_self->x_step, __pyx_v_self->nx); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+344: <span class="k">if</span> <span class="n">x_max</span> <span class="o"><</span> <span class="mf">0</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_x_max < 0) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+345: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0'> 346: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+347: <span class="n">y_min</span> <span class="o">=</span> <span class="n">find_min</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_step</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_y_min = __pyx_f_5pyart_3map_17_gate_to_grid_map_find_min(__pyx_v_y, __pyx_v_roi, __pyx_v_self->y_step); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+348: <span class="k">if</span> <span class="n">y_min</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">ny</span><span class="o">-</span><span class="mf">1</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_y_min > (__pyx_v_self->ny - 1)) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+349: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+350: <span class="n">y_max</span> <span class="o">=</span> <span class="n">find_max</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_step</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">ny</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_y_max = __pyx_f_5pyart_3map_17_gate_to_grid_map_find_max(__pyx_v_y, __pyx_v_roi, __pyx_v_self->y_step, __pyx_v_self->ny); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+351: <span class="k">if</span> <span class="n">y_max</span> <span class="o"><</span> <span class="mf">0</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_y_max < 0) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+352: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0'> 353: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+354: <span class="n">z_min</span> <span class="o">=</span> <span class="n">find_min</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_step</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_z_min = __pyx_f_5pyart_3map_17_gate_to_grid_map_find_min(__pyx_v_z, __pyx_v_roi, __pyx_v_self->z_step); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+355: <span class="k">if</span> <span class="n">z_min</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">nz</span><span class="o">-</span><span class="mf">1</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_z_min > (__pyx_v_self->nz - 1)) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+356: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+357: <span class="n">z_max</span> <span class="o">=</span> <span class="n">find_max</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">roi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_step</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nz</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_z_max = __pyx_f_5pyart_3map_17_gate_to_grid_map_find_max(__pyx_v_z, __pyx_v_roi, __pyx_v_self->z_step, __pyx_v_self->nz); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+358: <span class="k">if</span> <span class="n">z_max</span> <span class="o"><</span> <span class="mf">0</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_z_max < 0) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+359: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0'> 360: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+361: <span class="n">roi2</span> <span class="o">=</span> <span class="n">roi</span> <span class="o">*</span> <span class="n">roi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_roi2 = (__pyx_v_roi * __pyx_v_roi); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+362: <span class="k">for</span> <span class="n">xi</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">x_min</span><span class="p">,</span> <span class="n">x_max</span><span class="o">+</span><span class="mf">1</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_2 = (__pyx_v_x_max + 1); | |
for (__pyx_t_3 = __pyx_v_x_min; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { | |
__pyx_v_xi = __pyx_t_3; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+363: <span class="k">for</span> <span class="n">yi</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">y_min</span><span class="p">,</span> <span class="n">y_max</span><span class="o">+</span><span class="mf">1</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_4 = (__pyx_v_y_max + 1); | |
for (__pyx_t_5 = __pyx_v_y_min; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { | |
__pyx_v_yi = __pyx_t_5; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+364: <span class="k">for</span> <span class="n">zi</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">z_min</span><span class="p">,</span> <span class="n">z_max</span><span class="o">+</span><span class="mf">1</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_6 = (__pyx_v_z_max + 1); | |
for (__pyx_t_7 = __pyx_v_z_min; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { | |
__pyx_v_zi = __pyx_t_7; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+365: <span class="n">xg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_step</span> <span class="o">*</span> <span class="n">xi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_xg = (__pyx_v_self->x_step * __pyx_v_xi); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+366: <span class="n">yg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_step</span> <span class="o">*</span> <span class="n">yi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_yg = (__pyx_v_self->y_step * __pyx_v_yi); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+367: <span class="n">zg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_step</span> <span class="o">*</span> <span class="n">zi</span></pre> | |
<pre class='cython code score-0'> __pyx_v_zg = (__pyx_v_self->z_step * __pyx_v_zi); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+368: <span class="n">dist2</span> <span class="o">=</span> <span class="p">(</span><span class="n">xg</span><span class="o">-</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">xg</span><span class="o">-</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="n">yg</span><span class="o">-</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">yg</span><span class="o">-</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="n">zg</span><span class="o">-</span><span class="n">z</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">zg</span><span class="o">-</span><span class="n">z</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_dist2 = ((((__pyx_v_xg - __pyx_v_x) * (__pyx_v_xg - __pyx_v_x)) + ((__pyx_v_yg - __pyx_v_y) * (__pyx_v_yg - __pyx_v_y))) + ((__pyx_v_zg - __pyx_v_z) * (__pyx_v_zg - __pyx_v_z))); | |
</pre><pre class='cython line score-0'> 369: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+370: <span class="k">if</span> <span class="n">dist2</span> <span class="o">></span> <span class="n">roi2</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_dist2 > __pyx_v_roi2) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+371: <span class="k">continue</span></pre> | |
<pre class='cython code score-0'> goto __pyx_L13_continue; | |
} | |
</pre><pre class='cython line score-0'> 372: </pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+373: <span class="k">if</span> <span class="n">weighting_function</span> <span class="o">==</span> <span class="n">BARNES</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_weighting_function == __pyx_v_5pyart_3map_17_gate_to_grid_map_BARNES) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+374: <span class="n">weight</span> <span class="o">=</span> <span class="n">exp</span><span class="p">(</span><span class="o">-</span><span class="p">(</span><span class="n">dist2</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="mf">2</span><span class="o">*</span><span class="n">roi2</span><span class="p">))</span> <span class="o">+</span> <span class="mf">1e-5</span></pre> | |
<pre class='cython code score-0'> __pyx_v_weight = (exp(((-__pyx_v_dist2) / (2.0 * __pyx_v_roi2))) + 1e-5); | |
goto __pyx_L16; | |
} | |
/*else*/ { | |
</pre><pre class='cython line score-0'> 375: <span class="k">else</span><span class="p">:</span> <span class="c"># CRESSMAN</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+376: <span class="n">weight</span> <span class="o">=</span> <span class="p">(</span><span class="n">roi2</span> <span class="o">-</span> <span class="n">dist2</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">roi2</span> <span class="o">+</span> <span class="n">dist2</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_weight = ((__pyx_v_roi2 - __pyx_v_dist2) / (__pyx_v_roi2 + __pyx_v_dist2)); | |
} | |
__pyx_L16:; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+377: <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfields</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'> __pyx_t_8 = __pyx_v_self->nfields; | |
for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { | |
__pyx_v_i = __pyx_t_9; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+378: <span class="k">if</span> <span class="n">masks</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_10 = __pyx_v_i; | |
__pyx_t_1 = ((*((char *) ( /* dim=0 */ (__pyx_v_masks.data + __pyx_t_10 * __pyx_v_masks.strides[0]) ))) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+379: <span class="k">continue</span></pre> | |
<pre class='cython code score-0'> goto __pyx_L17_continue; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+380: <span class="bp">self</span><span class="o">.</span><span class="n">grid_sum</span><span class="p">[</span><span class="n">zi</span><span class="p">,</span> <span class="n">yi</span><span class="p">,</span> <span class="n">xi</span><span class="p">,</span> <span class="n">i</span><span class="p">]</span> <span class="o">+=</span> <span class="n">weight</span> <span class="o">*</span> <span class="n">values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span></pre> | |
<pre class='cython code score-0'> __pyx_t_11 = __pyx_v_i; | |
__pyx_t_12 = __pyx_v_zi; | |
__pyx_t_13 = __pyx_v_yi; | |
__pyx_t_14 = __pyx_v_xi; | |
__pyx_t_15 = __pyx_v_i; | |
*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->grid_sum.data + __pyx_t_12 * __pyx_v_self->grid_sum.strides[0]) ) + __pyx_t_13 * __pyx_v_self->grid_sum.strides[1]) ) + __pyx_t_14 * __pyx_v_self->grid_sum.strides[2]) )) + __pyx_t_15)) )) += (__pyx_v_weight * (*((float *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_11 * __pyx_v_values.strides[0]) )))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+381: <span class="bp">self</span><span class="o">.</span><span class="n">grid_wsum</span><span class="p">[</span><span class="n">zi</span><span class="p">,</span> <span class="n">yi</span><span class="p">,</span> <span class="n">xi</span><span class="p">,</span> <span class="n">i</span><span class="p">]</span> <span class="o">+=</span> <span class="n">weight</span></pre> | |
<pre class='cython code score-0'> __pyx_t_16 = __pyx_v_zi; | |
__pyx_t_17 = __pyx_v_yi; | |
__pyx_t_18 = __pyx_v_xi; | |
__pyx_t_19 = __pyx_v_i; | |
*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->grid_wsum.data + __pyx_t_16 * __pyx_v_self->grid_wsum.strides[0]) ) + __pyx_t_17 * __pyx_v_self->grid_wsum.strides[1]) ) + __pyx_t_18 * __pyx_v_self->grid_wsum.strides[2]) )) + __pyx_t_19)) )) += __pyx_v_weight; | |
__pyx_L17_continue:; | |
} | |
__pyx_L13_continue:; | |
} | |
} | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+382: <span class="k">return</span> <span class="mf">1</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 1; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 383: </pre> | |
<pre class='cython line score-0'> 384: </pre> | |
<pre class='cython line score-0'> 385: <span class="nd">@cython</span><span class="o">.</span><span class="n">cdivision</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+386: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">find_min</span><span class="p">(</span><span class="nb">float</span> <span class="n">a</span><span class="p">,</span> <span class="nb">float</span> <span class="n">roi</span><span class="p">,</span> <span class="nb">float</span> <span class="n">step</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'>static int __pyx_f_5pyart_3map_17_gate_to_grid_map_find_min(float __pyx_v_a, float __pyx_v_roi, float __pyx_v_step) { | |
int __pyx_v_a_min; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("find_min", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 387: <span class="sd">""" Find the mimumum gate index for a dimension. """</span></pre> | |
<pre class='cython line score-0'> 388: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">a_min</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+389: <span class="k">if</span> <span class="n">step</span> <span class="o">==</span> <span class="mf">0</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_step == 0.0) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+390: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+391: <span class="n">a_min</span> <span class="o">=</span> <span class="p"><</span><span class="kt">int</span><span class="p">></span><span class="n">ceil</span><span class="p">((</span><span class="n">a</span> <span class="o">-</span> <span class="n">roi</span><span class="p">)</span> <span class="o">/</span> <span class="n">step</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_a_min = ((int)ceil(((__pyx_v_a - __pyx_v_roi) / __pyx_v_step))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+392: <span class="k">if</span> <span class="n">a_min</span> <span class="o"><</span> <span class="mf">0</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_a_min < 0) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+393: <span class="n">a_min</span> <span class="o">=</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_v_a_min = 0; | |
goto __pyx_L4; | |
} | |
__pyx_L4:; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+394: <span class="k">return</span> <span class="n">a_min</span></pre> | |
<pre class='cython code score-0'> __pyx_r = __pyx_v_a_min; | |
goto __pyx_L0; | |
</pre><pre class='cython line score-0'> 395: </pre> | |
<pre class='cython line score-0'> 396: </pre> | |
<pre class='cython line score-0'> 397: <span class="nd">@cython</span><span class="o">.</span><span class="n">cdivision</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+398: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">find_max</span><span class="p">(</span><span class="nb">float</span> <span class="n">a</span><span class="p">,</span> <span class="nb">float</span> <span class="n">roi</span><span class="p">,</span> <span class="nb">float</span> <span class="n">step</span><span class="p">,</span> <span class="nb">int</span> <span class="n">na</span><span class="p">):</span></pre> | |
<pre class='cython code score-0'>static int __pyx_f_5pyart_3map_17_gate_to_grid_map_find_max(float __pyx_v_a, float __pyx_v_roi, float __pyx_v_step, int __pyx_v_na) { | |
int __pyx_v_a_max; | |
int __pyx_r; | |
<span class='refnanny'>__Pyx_RefNannyDeclarations</span> | |
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("find_max", 0); | |
/* … */ | |
/* function exit code */ | |
__pyx_L0:; | |
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>(); | |
return __pyx_r; | |
} | |
</pre><pre class='cython line score-0'> 399: <span class="sd">""" Find the maximum gate index for a dimension. """</span></pre> | |
<pre class='cython line score-0'> 400: <span class="k">cdef</span> <span class="kt">int</span> <span class="nf">a_max</span></pre> | |
<pre class='cython line score-0' onclick='toggleDiv(this)'>+401: <span class="k">if</span> <span class="n">step</span> <span class="o">==</span> <span class="mf">0</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_step == 0.0) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+402: <span class="k">return</span> <span class="mf">0</span></pre> | |
<pre class='cython code score-0'> __pyx_r = 0; | |
goto __pyx_L0; | |
} | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+403: <span class="n">a_max</span> <span class="o">=</span> <span class="p"><</span><span class="kt">int</span><span class="p">></span><span class="n">floor</span><span class="p">((</span><span class="n">a</span> <span class="o">+</span> <span class="n">roi</span><span class="p">)</span> <span class="o">/</span> <span class="n">step</span><span class="p">)</span></pre> | |
<pre class='cython code score-0'> __pyx_v_a_max = ((int)floor(((__pyx_v_a + __pyx_v_roi) / __pyx_v_step))); | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+404: <span class="k">if</span> <span class="n">a_max</span> <span class="o">></span> <span class="n">na</span><span class="o">-</span><span class="mf">1</span><span class="p">:</span></pre> | |
<pre class='cython code score-0'> __pyx_t_1 = ((__pyx_v_a_max > (__pyx_v_na - 1)) != 0); | |
if (__pyx_t_1) { | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+405: <span class="n">a_max</span> <span class="o">=</span> <span class="n">na</span><span class="o">-</span><span class="mf">1</span></pre> | |
<pre class='cython code score-0'> __pyx_v_a_max = (__pyx_v_na - 1); | |
goto __pyx_L4; | |
} | |
__pyx_L4:; | |
</pre><pre class='cython line score-0' onclick='toggleDiv(this)'>+406: <span class="k">return</span> <span class="n">a_max</span></pre> | |
<pre class='cython code score-0'> __pyx_r = __pyx_v_a_max; | |
goto __pyx_L0; | |
</pre></div></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment