Return `num` evenly spaced values over the closed interval [`start`, `stop`]. Parameters ---------- start : scalar The starting value of the sequence. stop : scalar The last value of the sequence. num : int, optional Number of samples to include
(
start, stop, num=50, endpoint=True, retstep=False, chunks="auto", dtype=None
)
| 304 | |
| 305 | |
| 306 | def linspace( |
| 307 | start, stop, num=50, endpoint=True, retstep=False, chunks="auto", dtype=None |
| 308 | ): |
| 309 | """ |
| 310 | Return `num` evenly spaced values over the closed interval [`start`, |
| 311 | `stop`]. |
| 312 | |
| 313 | Parameters |
| 314 | ---------- |
| 315 | start : scalar |
| 316 | The starting value of the sequence. |
| 317 | stop : scalar |
| 318 | The last value of the sequence. |
| 319 | num : int, optional |
| 320 | Number of samples to include in the returned dask array, including the |
| 321 | endpoints. Default is 50. |
| 322 | endpoint : bool, optional |
| 323 | If True, ``stop`` is the last sample. Otherwise, it is not included. |
| 324 | Default is True. |
| 325 | retstep : bool, optional |
| 326 | If True, return (samples, step), where step is the spacing between |
| 327 | samples. Default is False. |
| 328 | chunks : int |
| 329 | The number of samples on each block. Note that the last block will have |
| 330 | fewer samples if `num % blocksize != 0` |
| 331 | dtype : dtype, optional |
| 332 | The type of the output array. |
| 333 | |
| 334 | Returns |
| 335 | ------- |
| 336 | samples : dask array |
| 337 | step : float, optional |
| 338 | Only returned if ``retstep`` is True. Size of spacing between samples. |
| 339 | |
| 340 | |
| 341 | See Also |
| 342 | -------- |
| 343 | dask.array.arange |
| 344 | """ |
| 345 | num = int(num) |
| 346 | |
| 347 | if dtype is None: |
| 348 | dtype = np.linspace(0, 1, 1).dtype |
| 349 | |
| 350 | chunks = normalize_chunks(chunks, (num,), dtype=dtype) |
| 351 | |
| 352 | range_ = stop - start |
| 353 | |
| 354 | div = (num - 1) if endpoint else num |
| 355 | if div == 0: |
| 356 | div = 1 |
| 357 | |
| 358 | step = float(range_) / div |
| 359 | |
| 360 | name = "linspace-" + tokenize((start, stop, num, endpoint, chunks, dtype)) |
| 361 | |
| 362 | dsk = {} |
| 363 | blockstart = start |
nothing calls this directly
no test coverage detected
searching dependent graphs…