Internal workhorse function for single request Where applicable this includes a check that parameters are less than or equal to one, determines the appropriate RNG funtion, checks the parameters for that function, clips the value range of the result of the RNG functi
(self, target, count, **kwargs)
| 153 | return result |
| 154 | |
| 155 | def _generate_single(self, target, count, **kwargs): |
| 156 | """Internal workhorse function for single request |
| 157 | |
| 158 | Where applicable this includes a check that parameters are less |
| 159 | than or equal to one, determines the appropriate RNG funtion, |
| 160 | checks the parameters for that function, clips the value range |
| 161 | of the result of the RNG function, and returns the result. |
| 162 | |
| 163 | """ |
| 164 | # If destined for a le_1_target, check validity. |
| 165 | if target in self._le_1_targets: |
| 166 | self._check_le_1(target, **kwargs) |
| 167 | # Otherwise figure out what function |
| 168 | func = self._determine_func(**kwargs) |
| 169 | # Check to make sure sufficient parameters exist |
| 170 | self._check_parameters(func, **kwargs) |
| 171 | # Run the function |
| 172 | results = func(count, **kwargs) |
| 173 | # Clip if in le_1_targets |
| 174 | if target in self._le_1_targets: |
| 175 | results = np.clip(results, 0.0, 1.0) |
| 176 | # Otherwise ensure simply above zero |
| 177 | else: |
| 178 | results = np.clip(results, 0.0, np.inf) |
| 179 | return results |
| 180 | |
| 181 | def generate_multi(self, prefixed_target, count, kwargs_dict): |
| 182 | """Generates aggregate risk data for multiple targets |
no test coverage detected