def gnom(curve, Rmax, outputfilename=None, Npoints_realspace=None, initial_alpha=None):
with tempfile.TemporaryDirectory(prefix='<STR_LIT>') as td:<EOL><INDENT>curve.save(os.path.join(td, '<STR_LIT>'))<EOL>print('<STR_LIT>'.format(curve.q.min(), curve.q.max()))<EOL>if Npoints_realspace is None:<EOL><INDENT>Npoints_realspace = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>Npoints_realspace = str(Npoints_realspace)<EOL><DEDENT>if initial_alpha is None:<EOL><INDENT>initial_alpha = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>initial_alpha = str(initial_alpha)<EOL><DEDENT>gnominput = "<STR_LIT>" % (<EOL>os.path.join(td, '<STR_LIT>'), os.path.join(td, '<STR_LIT>'), <NUM_LIT:10> * Rmax, Npoints_realspace, initial_alpha)<EOL>result = subprocess.run(['<STR_LIT>'], stdout=subprocess.PIPE, stderr=subprocess.PIPE,<EOL>input=gnominput.encode('<STR_LIT:utf-8>'))<EOL>pr, metadata = read_gnom_pr(os.path.join(td, '<STR_LIT>'), True)<EOL>pr[:, <NUM_LIT:0>] /= <NUM_LIT:10><EOL>metadata['<STR_LIT:q>'] *= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] *= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] *= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] *= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] /= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] /= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] /= <NUM_LIT:10><EOL>metadata['<STR_LIT>'] /= <NUM_LIT:10><EOL>if outputfilename is not None:<EOL><INDENT>shutil.copy(os.path.join(td, '<STR_LIT>'), outputfilename)<EOL><DEDENT><DEDENT>return pr, metadata<EOL>
Run GNOM on the dataset.

    Inputs:
        curve: an instance of sastool.classes2.Curve or anything which has a
            save() method, saving the scattering curve to a given .dat file,
            in q=4*pi*sin(theta)/lambda [1/nm] units
        Rmax: the estimated maximum extent of the scattering object, in nm.
        outputfilename: the preferred name of the output file. If not given,
            the .out file produced by gnom will be lost.
        Npoints_realspace: the expected number of points in the real space
        initial_alpha: the initial value of the regularization parameter.

    Outputs:
        the same as of read_gnom_pr()