#!/usr/bin/env python
"""Generate fixtures."""

import os
import json
import numpy as np
from scipy.special import sici

# Get the file path:
FILE = os.path.realpath(__file__)

# Extract the directory in which this file resides:
DIR = os.path.dirname(FILE)


def gen(x, name):
    """Generate fixture data and writes them to file.

    # Arguments

    * `x`: domain
    * `name::str`: output filename

    # Examples

    ``` python
    python> x = linspace(0.0, 1.0, 2001)
    python> gen(x, './data.json')
    ```
    """
    y = sici(x)

    # Store data to be written to file as a dictionary:
    data = {
        "x": x.tolist(),
        "si": y[0].tolist(),
        "ci": y[1].tolist()
    }

    # Based on the script directory, create an output filepath:
    filepath = os.path.join(DIR, name)

    # Write the data to the output filepath as JSON:
    with open(filepath, "w") as outfile:
        json.dump(data, outfile)


def main():
    """Generate fixture data."""
    x = np.linspace(0.0001, 0.25, 500)
    gen(x, "small_positive.json")

    x = np.linspace(0.25, 5.0, 500)
    gen(x, "medium_positive.json")

    x = np.linspace(5.0, 100.0, 500)
    gen(x, "large_positive.json")

    x = np.linspace(-0.0001, -0.25, 500)
    gen(x, "small_negative.json")

    x = np.linspace(-0.25, -5.0, 500)
    gen(x, "medium_negative.json")

    x = np.linspace(-5.0, -100.0, 500)
    gen(x, "large_negative.json")

    x = np.linspace(1e9, 1e12, 500)
    gen(x, "very_large.json")

if __name__ == "__main__":
    main()

#!/usr/bin/env python
"""Generate fixtures."""

import os
import json
import numpy as np
from scipy.special import sici

# Get the file path:
FILE = os.path.realpath(__file__)

# Extract the directory in which this file resides:
DIR = os.path.dirname(FILE)


def gen(x, name):
    """Generate fixture data and writes them to file.

    # Arguments

    * `x`: domain
    * `name::str`: output filename

    # Examples

    ``` python
    python> x = linspace(0.0, 1.0, 2001)
    python> gen(x, './data.json')
    ```
    """
    y = sici(x)

    # Store data to be written to file as a dictionary:
    data = {
        "x": x.tolist(),
        "si": y[0].tolist(),
        "ci": y[1].tolist()
    }

    # Based on the script directory, create an output filepath:
    filepath = os.path.join(DIR, name)

    # Write the data to the output filepath as JSON:
    with open(filepath, "w") as outfile:
        json.dump(data, outfile)


def main():
    """Generate fixture data."""
    x = np.linspace(0.0001, 0.25, 500)
    gen(x, "small_positive.json")

    x = np.linspace(0.25, 5.0, 500)
    gen(x, "medium_positive.json")

    x = np.linspace(5.0, 100.0, 500)
    gen(x, "large_positive.json")

    x = np.linspace(-0.0001, -0.25, 500)
    gen(x, "small_negative.json")

    x = np.linspace(-0.25, -5.0, 500)
    gen(x, "medium_negative.json")

    x = np.linspace(-5.0, -100.0, 500)
    gen(x, "large_negative.json")

    x = np.linspace(1.0e9, 1.0e12, 500)
    gen(x, "very_large.json")


if __name__ == "__main__":
    main()

Add decimals and fix lint error