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

import os
import json
from math import pi
import numpy as np
from scipy.special import cosm1

# 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 write to file.

    # Arguments

    * `x`: domain
    * `name::str`: filepath of the output file

    # Examples

    ``` python
    python> x = linspace(-1000, 1000, 2001)
    python> gen(x, './data.json')
    ```
    """
    y = cosm1(x)
    data = {
        "x": x.tolist(),
        "expected": y.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(-pi/4, pi/4, 2003)
    gen(x, "data.json")


if __name__ == "__main__":
    main()

@@ -265,20 +265,20 @@
 dirname(
-file
+FILE
 )%0A%0A%0Adef 

Fix variable name