-
Notifications
You must be signed in to change notification settings - Fork 1
Home
- The document was generated by ChatGPT. Please note that the content may not be completely accurate or relevant to your needs.
- SharPy is a Python script that performs a deconvolution of the Particle Pair Distribution Function (PDDF) in small-angle scattering experiments. It allows users to easily specify input files and tune the parameters.
SharPy is a Python script that performs a deconvolution of the Particle Pair Distribution Function (PDDF) in small-angle scattering experiments. In brief, SharPy uses a single-particle PDDF as an initial guess and then optimizes the PDDF by minimizing the difference between the measured PDDF and the synthetic PDDF.
To use SharPy, a user needs to specify an input file and some parameters.
The input file should be in a binary format and contain a PDDF that was measured by a small-angle scattering experiment. Currently, SharPy supports two file formats: out and pickle. In the out format, the file should have two columns separated by a space or a tab, where the first column is the distance and the second column is the PDDF. In the pickle format, the file should be a binary file that contains a single numpy array containing the PDDF.
The following parameters can be tuned in SharPy:
-
method: The optimization method used to minimize the difference between the measured PDDF and the synthetic PDDF. The default method isBFGS. -
mode: The speed of the optimization process. There are three options:fast,medium, andslow. The default mode isslow. -
fend: The file format of the input file. The two options areoutandpickle. The default isout. -
s: The standard deviation of the size distribution. The default is0.25. -
m: The mean of the size distribution. The default is50. -
dist: The type of the size distribution. The two options arelognormandnormal. The default islognorm. -
R_size: The number of data points used for the single-particle PDDF. The default is51. -
save: Whether to save the optimized PDDF and optimization results. The default isTrue. -
output_fname: The name of the output file. If not specified, a default name is generated.
Here is an example of how to use SharPy:
# read the input file
input_fname = 'example.out'
# set the size distribution parameters
s = 0.15
m = 50
dist = 'lognorm'
# set the number of data points used for the single-particle PDDF
R_size = 51
# run the optimization
res = SharPy.optimize(pdf_sync, s, m, dist, R_size)
# save the optimized PDDF and optimization results
output_fname = 'example_optimized'
SharPy.save(res, output_fname)
In this example, SharPy reads the PDDF from the example.out file, sets the size distribution parameters and the number of data points used for the single-particle PDDF, and then runs the optimization. The optimization results are saved in the example_optimized file.