CN112037183B - 2D SAXS map calculation method and device - Google Patents

2D SAXS map calculation method and device Download PDF

Info

Publication number
CN112037183B
CN112037183B CN202010817053.8A CN202010817053A CN112037183B CN 112037183 B CN112037183 B CN 112037183B CN 202010817053 A CN202010817053 A CN 202010817053A CN 112037183 B CN112037183 B CN 112037183B
Authority
CN
China
Prior art keywords
saxs
preset
spectrum
map
angle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010817053.8A
Other languages
Chinese (zh)
Other versions
CN112037183A (en
Inventor
朱才镇
唐正
刘会超
于佳立
徐坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen University
Original Assignee
Shenzhen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen University filed Critical Shenzhen University
Priority to CN202010817053.8A priority Critical patent/CN112037183B/en
Publication of CN112037183A publication Critical patent/CN112037183A/en
Application granted granted Critical
Publication of CN112037183B publication Critical patent/CN112037183B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10056Microscopic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10116X-ray image

Abstract

The embodiment of the application discloses a calculation method of a two-dimensional small-angle X-ray scattering 2D SAXS spectrum, which comprises the steps of generating a first 2D SAXS spectrum based on a GPU parallel calculation technology according to preset distribution parameters, and comparing the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum: updating the preset 2D SAXS map according to the first 2D SAXS map when the variation is greater than a preset threshold; and when the variation is smaller than or equal to the preset threshold, determining the first 2D SAXS map as a target 2D SAXS map. According to the high-flux 2D SAXS spectrum calculation method, the pixel intensity value of each pixel point on the 2D SAXS spectrum is calculated simultaneously and parallelly by using a plurality of threads in the GPU, so that the calculation speed (second order) of a single 2D SAXS spectrum is greatly improved.

Description

2D SAXS map calculation method and device
Technical Field
The application relates to the technical field of high-performance parallel computation and small-angle X-ray scattering intersection, in particular to a 2D SAXS spectrum computation method and device.
Background
Small Angle X-ray Scattering (SAXS) refers to the phenomenon of coherent Scattering of X-rays by electrons in a Small angular range near the original X-ray beam, and by analyzing the fluctuation of the X-ray Scattering intensity caused by the difference of electron density between the substrate and the microstructure in the sample, the shape, size, distribution, content and other space geometric information of the microstructure (including micro-nano particles, pore structures and the like) in the nano-scale (1-1000 nm) range inside the material can be effectively detected. Meanwhile, the SAXS technology has the characteristics of high penetrability, simple sample preparation, nondestructive detection, rapid test, good statistics, wide application range and the like, is an indispensable microscopic-mesoscale key analysis characterization means in the current novel material nanoscale microstructure high-throughput characterization technology, and is widely applied to various research fields of alloys, suspensions, emulsions, colloids, macromolecule solutions, natural macromolecules, liquid crystals, films, polyelectrolytes, composites, nano materials and the like.
Although some methods exist in the prior art for effectively calculating the theoretical 2D SAXS spectrum of the anisotropic system, the calculation amount of the theoretical 2D SAXS spectrum is usually huge, multiple iterations and ensemble averages are required to meet the statistical requirement, and the calculation speed of the single Zhang Lilun 2D SAXS spectrum cannot meet the actual research requirement.
Disclosure of Invention
The embodiment of the application provides a calculation method of a two-dimensional small-angle X-ray scattering 2D SAXS spectrum, which comprises the steps of generating a first 2D SAXS spectrum based on a GPU parallel calculation technology according to preset distribution parameters, and comparing the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum: updating the preset 2D SAXS map according to the first 2D SAXS map when the variation is greater than a preset threshold; and when the variation is smaller than or equal to the preset threshold, determining the first 2D SAXS map as a target 2D SAXS map. According to the computing method, the pixel intensity value of each pixel point on the 2D SAXS map is computed simultaneously and parallelly by using a plurality of threads in the GPU, so that the computing speed (second order) of a single 2D SAXS map is greatly improved.
An embodiment of the present application provides a method for calculating a 2D SAXS spectrum, applied to an electronic device, where the method for calculating the 2D SAXS spectrum includes: generating a first 2D SAXS map according to preset distribution parameters; calculating the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of a preset 2D SAXS spectrum; updating the preset 2D SAXS map according to the first 2D SAXS map when the variation is greater than a preset threshold; and when the variation is smaller than or equal to the preset threshold, determining the first 2D SAXS map as a target 2D SAXS map.
It can be seen that, in this embodiment, the method for calculating the 2D SAXS spectrum generates a first 2D SAXS spectrum based on the GPU parallel computing technology according to the preset distribution parameter, and then compares the variation of the average pixel intensity value of the first 2D SAXS spectrum with the average pixel intensity value of the preset 2D SAXS spectrum, and performs multiple iterations to determine the target 2D SAXS spectrum. According to the method, the pixel intensity value of each pixel point on the 2D SAXS map is calculated simultaneously and parallelly by utilizing a plurality of threads in the GPU, so that the calculation speed of a single 2D SAXS map is greatly improved, and the calculation requirement of massive 2D SAXS maps can be met.
With reference to the first aspect, in a possible implementation manner, the method further includes: when the variation is larger than the preset threshold, and after the preset 2D SAXS map is updated, generating a second 2D SAXS map according to the preset distribution parameters; updating the image content of the first 2D SAXS profile to the image content of the second 2D SAXS profile.
With reference to the first aspect, in a possible implementation manner, the generating the first 2D SAXS map according to the preset distribution parameter includes: determining first model data of N scatterers according to the preset distribution parameters, wherein N is a positive integer; the first 2D SAXS map is generated from the first model data.
With reference to the first aspect, in a possible implementation manner, the generating a second 2D SAXS map according to the preset distribution parameter includes: determining second model data of M scatterers according to the preset distribution parameters, wherein M is a positive integer; and generating a second 2D SAXS atlas according to the second model data.
With reference to the first aspect, in a possible implementation manner, the updating the preset 2D SAXS profile includes: and adding the pixel intensity values of the corresponding pixel points on the first 2D SAXS spectrum and the preset 2D SAXS spectrum, and then taking an average value to obtain the updated preset 2D SAXS spectrum.
With reference to the first aspect, in a possible implementation manner, the generating the first 2D SAXS map according to the first model data includes: respectively establishing five first matrixes of the shape, the long axis, the short axis, the zenith angle and the attitude of N scatterers in the first model data, wherein each scatterer in the N scatterers comprises a group of shape, the long axis, the short axis, the zenith angle and the attitude data; the first 2D SAXS profile is calculated from the five first matrices.
With reference to the first aspect, in a possible implementation manner, the generating a second 2D SAXS map according to the second model data includes: respectively establishing five second matrixes of the shapes, the long axes, the short axes, the zenith angles and the attitude angles of M scattering bodies in the second model data, wherein each scattering body in the M scattering bodies comprises a group of shape, long axes, short axes, zenith angles and attitude angle data; and calculating the second 2D SAXS map according to the five second matrixes.
A second aspect of an embodiment of the present application provides an apparatus for calculating a 2D SAXS map, comprising: the generation module is used for generating a first 2D SAXS map according to preset distribution parameters; the calculating module is used for calculating the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of a preset 2D SAXS spectrum; an updating module, configured to update the preset 2D SAXS spectrum according to the first 2D SAXS spectrum when the variation is greater than a preset threshold; and the determining module is used for determining the first 2D SAXS map as a target 2D SAXS map when the variation is smaller than or equal to the preset threshold value.
A third aspect of the embodiments of the present application provides an electronic device, including: a processor and a memory; the processor is connected to a memory, wherein the memory is adapted to store program code, and the processor is adapted to invoke the program code to perform the method according to any of the first aspect.
A fourth aspect of the present embodiments provides a computer storage medium storing a computer program comprising program instructions which, when executed by a processor, perform a method according to any one of the first aspects above.
Drawings
The drawings used in the embodiments of the present application are described below.
FIG. 1 is a flowchart of a method for computing a 2D SAXS map according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for computing a 2D SAXS atlas according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an apparatus for calculating a 2D SAXS map according to an embodiment of the present application;
FIG. 4 is a schematic diagram of another apparatus for computing 2D SAXS patterns according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device for calculating a 2D SAXS map according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a 2D SAXS spectrum calculating method and device, wherein the 2D SAXS spectrum calculating method is used in electronic equipment, and according to the 2D SAXS spectrum calculating method, the calculating speed of a single 2D SAXS spectrum can be greatly improved.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a method for calculating a 2D SAXS map according to an embodiment of the application; the method for calculating the 2D SAXS map comprises the following steps:
step S101: and determining first model data of N scatterers according to preset distribution parameters, wherein N is a positive integer.
Specifically, the first model data of the N scatterers are determined according to the preset distribution parameters, wherein the preset distribution parameters are a set of statistical parameters of the N scatterers, including the shape, the size and the angular distribution parameters of the N scatterers, and the N scatterers have the same shape, that is, the N scatterers are all ellipsoids, ultra-ellipsoids or other shapes, and the preset distribution parameters are randomly generated from a range of values obtained through experiments according to a random uniform function; the first model data comprise N groups of shape, size and angle values, and the N scatterers are in one-to-one correspondence with the N groups of shape, size and angle values; and respectively bringing the size and the angle distribution parameters into corresponding distribution functions to obtain N groups of size and angle values, wherein when the shapes of the scatterers are different, the shapes of the scatterers are described to be different correspondingly, the N groups of shape values in the first model data are generated from a certain value range of undetermined coefficients in the shapes of the shapes corresponding to the N scatterers according to the random uniform distribution functions, and the certain value range is obtained according to experiments.
The random uniform distribution function can be random.RAND in a numerical calculation function library NUMPY or any function similar to functions in other function libraries in NUMPY.
For example, when the N scatterers are in the shape of a spheroid, the dimensions of the spheroid include a major axis and a minor axis, and the angles of the spheroid include zenith angles and attitude angles; at this time, the size distribution parameters in the preset distribution parameters include a long axis parameter and a short axis parameter, the distribution functions corresponding to the long axis parameter and the short axis parameter are all lognormal distribution functions, the long axis parameter is substituted into the lognormal distribution functions, the N long axis sizes of the N scatterers are obtained according to the random uniform distribution function, the short axis parameter is substituted into the lognormal distribution functions, and the N short axis sizes of the N scatterers are obtained according to the random uniform distribution function; the angle distribution parameters in the preset distribution parameters comprise zenith angle parameters, the distribution function corresponding to the zenith angle distribution parameters is circular distribution, the zenith angle parameters are substituted into the circular distribution function, and N zenith angle of the N scatterers are obtained according to the random uniform distribution function; the numerical values of N attitude angles of the N scatterers are obtained according to the random uniform distribution function; describing a shape function of the super-ellipsoid as a super-ellipsoid function, wherein the super-ellipsoid function controls the undetermined coefficient of the specific shape of the super-ellipsoid to be smooth degree e in the horizontal direction and smooth degree N in the vertical direction, and the numerical values of N groups e and N of the N scatterers are determined according to the random uniform distribution function; in summary, when the N scatterers are in the shape of a super-ellipsoid, the first model data includes N sets of numerical values of smoothness in a horizontal direction, smoothness in a vertical direction, a long axis, a short axis, a zenith angle, and an attitude angle; it is to be understood that, when the shapes of the N scatterers are other shapes, the preset distribution parameters and the calculated corresponding first model data are different.
Wherein the long axis parameters comprise a long axis mean and a long axis variance, the short axis parameters comprise a short axis mean and a short axis variance, and the zenith angle parameters comprise a zenith angle mean and a zenith angle variance.
Step S102: a first 2D SAXS map is generated from the first model data.
Specifically, the first model data is matrixed according to a RESHAPE function or a function similar to the function in a numerical calculation function library NUMPY, namely, five first matrixes are respectively built according to N groups of shape, long axis size, short axis size, zenith angle and attitude angle data in the first model data; converting the numerical types in the five first matrixes into single-precision floating point type according to an ASTYPE function or a function similar to the ASTYPE function in the numerical calculation function library NUMPY; and copying the first matrix of single-precision floating point type stored in the CPU into the GPU memory according to the PYCUDA function or a function similar to the function in the numerical calculation function library NUMPY.
Further, initializing all computing units in the GPU by a two-dimensional Grid (Grid), initializing each Grid point by a two-dimensional Thread Block (Block), and initializing each Thread Block by a two-dimensional Thread (Thread) to obtain initialization parameters, wherein the initialization parameters are determined together according to the size of a 2DSAXS map and the maximum number of threads supported by a single stream processor of the GPU equipment, and the initialization parameters are the number of threads which are simultaneously started when the 2DSAXS map is calculated; performing calculation of pixel values of single pixel points in the 2DSAXS spectrum by using a single thread, and simultaneously calculating the pixel values of each pixel point in the 2DSAXS spectrum by using a plurality of threads according to the first matrix converted into single-precision floating points so as to quickly obtain the first 2D SAXS spectrum, wherein the single thread completes coordinate indexes of the pixel points corresponding to the single thread according to BLOCKIDX and BLOCKDIM functions or other functions similar to the functions in the numerical calculation function library NUMPY; the pixel value of a single pixel point in the 2DSAXS map is obtained by summing the pixel contribution value of each of the N scatterers to the pixel point, and the contribution of each of the N scatterers to the pixel intensity of different pixel points in the 2DSAXS map is determined based on the density distribution or the shape factor of each scatterer.
Step S103: and calculating the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of a preset 2D SAXS spectrum.
Specifically, the pixel values of the corresponding pixel points calculated by each thread in the GPU are summed (the number of scatterers is summed), and then an average value is obtained to obtain an average pixel intensity value of the first 2D SAXS spectrum, the average pixel intensity value of the preset 2D SAXS spectrum is calculated by using the GPU, and the average pixel intensity value of the first 2D SAXS spectrum is compared with the average pixel intensity value of the preset 2D SAXS spectrum to obtain the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum.
In the first calculation process of the first 2D SAXS spectrum, the preset 2D SAXS spectrum may be set to an arbitrary spectrum having the same size as the first 2D SAXS spectrum.
Step S104: and updating the preset 2D SAXS map according to the first 2D SAXS map when the variation is greater than a preset threshold.
Specifically, when the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum is greater than the preset threshold, adding the pixel values of the corresponding pixel points on the first 2D SAXS spectrum and the preset 2D SAXS spectrum, and then taking an average value to obtain the updated preset 2DSAXS spectrum.
The preset threshold is one percent or any other value, which is determined by a specific application scenario and is not specifically limited herein.
Step S105: and when the variation is smaller than or equal to the preset threshold, determining the first 2D SAXS map as a target 2D SAXS map.
Specifically, when the variation of the average pixel intensity value of the first 2D SAXS spectrum from the average pixel intensity value of a preset 2D SAXS spectrum is less than or equal to the preset threshold, the first 2D SAXS spectrum is determined as the target 2D SAXS spectrum.
It can be seen that, in this embodiment, the method for calculating the 2D SAXS spectrum generates a first 2D SAXS spectrum based on the GPU parallel computing technology according to the preset distribution parameter, and then compares the variation of the average pixel intensity value of the first 2D SAXS spectrum with the average pixel intensity value of the preset 2D SAXS spectrum, and performs multiple iterations to determine the target 2D SAXS spectrum. According to the method, the pixel intensity value of each pixel point on the 2D SAXS map is calculated simultaneously and parallelly by utilizing a plurality of threads in the GPU, so that the calculation speed of a single 2D SAXS map is greatly improved, and the calculation requirement of massive 2D SAXS maps can be met.
In a possible embodiment, the method further comprises: and when the variation is larger than the preset threshold, and after the preset 2D SAXS map is updated, updating the first 2D SAXS map according to the preset distribution parameters.
Specifically, when the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum is greater than the preset threshold, and after the preset 2D SAXS spectrum is updated, determining second model data of M scatterers according to the preset distribution parameters, performing matrixing processing on the second model data to obtain five second matrices, generating the second 2D SAXS spectrum according to the five second matrices, and performing multithreading parallel computation by using a GPU, and replacing the spectrum content of the second 2D SAXS spectrum with the spectrum content of the first 2D SAXS spectrum to complete the updating of the first 2D SAXS spectrum.
The specific process of obtaining the second 2D SAXS spectrum is the same as the process of obtaining the first 2D SAXS spectrum in step S101, and is not described herein, where M is a positive integer.
Referring to fig. 2, fig. 2 is a flowchart of another method for calculating a 2D SAXS spectrum according to an embodiment of the present application, where the method for calculating a 2D SAXS spectrum includes:
step S201: first model data is acquired.
Specifically, the first model data of the N scatterers are determined according to the preset distribution parameters, wherein the preset distribution parameters are a set of statistical parameters of the N scatterers, including the shape, the size and the angular distribution parameters of the N scatterers, and the N scatterers have the same shape, that is, the N scatterers are all ellipsoids, ultra-ellipsoids or other shapes, and the preset distribution parameters are randomly generated from a range of values obtained through experiments according to a random uniform function; the first model data comprise N groups of shape, size and angle values, and the N scatterers are in one-to-one correspondence with the N groups of shape, size and angle values; and respectively bringing the size and the angle distribution parameters into corresponding distribution functions to obtain N groups of size and angle values, wherein when the shapes of the scatterers are different, the shapes of the scatterers are described to be different correspondingly, the N groups of shape values in the model data are generated from a certain value range of undetermined coefficients in the shapes of the corresponding N scatterers according to the random uniform distribution functions, and the certain value range is obtained according to experiments.
Other detailed procedures in this step are the same as those in step S101, and will not be described here again.
Step S202: copying the first model data stored in the CPU to the GPU.
Specifically, the first model data is matrixed according to a RESHAPE function or a function similar to the function in a numerical calculation function library NUMPY, namely, five first matrixes are respectively built according to N groups of shape, long axis size, short axis size, zenith angle and attitude angle data in the first model data; converting the numerical types in the five first matrixes into single-precision floating point type according to an ASTYPE function or a function similar to the ASTYPE function in the numerical calculation function library NUMPY; and copying the first matrix of single-precision floating point type stored in the CPU into the GPU memory according to the PYCUDA function or a function similar to the function in the numerical calculation function library NUMPY.
Step S203: and generating the first 2D SAXS atlas according to the first model data and by using GPU to perform parallel computation.
Specifically, initializing all computing units in the GPU by using a two-dimensional Grid (Grid), initializing each Grid point by using a two-dimensional Thread Block (Block), and initializing each Thread Block by using a two-dimensional Thread (Thread) to obtain initialization parameters, wherein the initialization parameters are determined according to the size of a 2DSAXS map and the maximum number of threads supported by a single stream processor of the GPU equipment, and the initialization parameters are the number of threads which are simultaneously started when the 2DSAXS map is calculated; performing calculation of pixel values of single pixel points in the 2DSAXS spectrum by using a single thread, and simultaneously calculating the pixel values of each pixel point in the 2DSAXS spectrum by using a plurality of threads according to the first matrix converted into single-precision floating points so as to quickly obtain the first 2D SAXS spectrum, wherein the single thread completes coordinate indexes of the pixel points corresponding to the single thread according to BLOCKIDX and BLOCKDIM functions or other functions similar to the functions in the numerical calculation function library NUMPY; the pixel value of a single pixel point in the 2DSAXS map is obtained by summing the pixel contribution value of each of the N scatterers to the pixel point, and the contribution of each of the N scatterers to the pixel intensity of different pixel points in the 2DSAXS map is determined based on the density distribution or the shape factor of each scatterer.
Step S204: and determining a target 2D SAXS map according to the first 2D SAXS map and the preset 2D SAXS map.
Specifically, calculating the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of a preset 2D SAXS spectrum, and when the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum is greater than the preset threshold, adding the pixel values of the corresponding pixel points on the first 2D SAXS spectrum and the preset 2D SAXS spectrum, and taking an average value to obtain the updated preset 2DSAXS spectrum; after the updating of the preset 2D SAXS spectrum is finished, steps S201 to S203 are repeatedly executed to update the first 2D SAXS spectrum according to the preset distribution parameters, and the specific updating process of the first 2D SAXS spectrum is shown in the method embodiment shown in fig. 1, which is not repeated herein; and determining the first 2D SAXS atlas as the target 2D SAXS atlas when the variation of the average pixel intensity value of the first 2D SAXS atlas relative to the average pixel intensity value of the preset 2D SAXS atlas is less than or equal to the preset threshold.
Step S205: the target 2D SAXS spectrum is passed back from the GPU to the CPU.
Specifically, the target 2D SAXS spectrum obtained after GPU parallel computation and multiple iterations is reversely returned from the GPU device memory to the CPU device memory.
The following details the time duration required for calculating the target 2D SAXS spectrum under nine different sets of the preset distribution parameters using the 2D SAXS spectrum calculation method and apparatus according to the embodiments of the present application.
(1) When the shape of the scatterer is ellipsoid, the short axis mean value is 18.6nm, the short axis variance is 155.3nm, the long axis mean value is 196.1nm, the long axis variance is 160.6nm, the zenith angle mean value is 52.7 degrees, and the zenith angle variance parameter is 70.0, the calculation time of a single 512×512 pixel 2DSAXS image is 0.41 seconds.
(2) When the scatterer is in an ellipsoidal shape, the short-axis mean value is 32.3nm, the short-axis variance is 77.8nm, the long-axis mean value is 238.3nm, the long-axis variance is 55.7nm, the zenith angle mean value is 68.3 degrees, and the calculation time of a single 512×512 pixel SAXS image is 0.46 seconds under the condition that the zenith angle variance parameter is 17.7.
(3) The scatterer is in an ellipsoidal shape, the short-axis mean value is 36.6nm, the short-axis variance is 195.2nm, the long-axis mean value is 156.0nm, the long-axis variance is 50.7nm, the zenith angle mean value is 47.2 degrees, and under the condition that the zenith angle variance parameter is 24.1, the calculation time of a single 512×512 pixel SAXS image is 0.39 seconds.
(4) The scatterer is in an ellipsoidal shape, the short-axis mean value is 17.1nm, the short-axis variance is 154.0nm, the long-axis mean value is 155.6nm, the long-axis variance is 142.5nm, the zenith angle mean value is 7.3 degrees, and under the condition that the zenith angle variance parameter is 56.1, the calculation time of a single 1024×1024 pixel SAXS image is 1.62 seconds.
(5) The scatterer is in an ellipsoidal shape, the short-axis mean value is 30.6nm, the short-axis variance is 69.3nm, the long-axis mean value is 190.1nm, the long-axis variance is 147.2nm, the zenith angle mean value is 79.8 degrees, and under the condition that the zenith angle variance parameter is 29.3, the calculation time of a single 1024×1024 pixel SAXS image is 1.56 seconds.
(6) The scatterer is in an ellipsoidal shape, the short-axis mean value is 31.6nm, the short-axis variance is 80.4nm, the long-axis mean value is 218.6nm, the long-axis variance is 118.6nm, the zenith angle mean value is 0.8 DEG, and the calculation time of a single 1024×1024 pixel SAXS image is 1.60 seconds under the condition that the zenith angle variance parameter is 24.5.
(7) The scatterer is in an ellipsoidal shape, the short-axis mean value is 14.8nm, the short-axis variance is 181.7nm, the long-axis mean value is 243.1nm, the long-axis variance is 97.7nm, the zenith angle mean value is 7.4 degrees, and under the condition that the zenith angle variance parameter is 79.3, the calculation time of a single 2048×2048 pixel SAXS image is 6.26 seconds.
(8) The scatterer is in an ellipsoidal shape, the short-axis mean value is 20.8nm, the short-axis variance is 137.3nm, the long-axis mean value is 180.0nm, the long-axis variance is 65.4nm, the zenith angle mean value is 16.4 degrees, and under the condition that the zenith angle variance parameter is 16.3, the calculation time of a single 2048×2048 pixel SAXS image is 6.19 seconds.
(9) The scatterer is in an ellipsoidal shape, the short-axis mean value is 24.0nm, the short-axis variance is 194.6nm, the long-axis mean value is 221.2nm, the long-axis variance is 138.3nm, the zenith angle mean value is 64.1 degrees, and under the condition that the zenith angle variance parameter is 79.6, the calculation time of a single 2048×2048 pixel SAXS image is 6.25 seconds.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an apparatus for calculating a 2D SAXS map according to an embodiment of the present application; as shown in fig. 3, the apparatus 300 for calculating a 2D SAXS profile includes the following modules.
A generating module 301, configured to generate a first 2D SAXS map according to a preset distribution parameter;
a calculating module 302, configured to calculate a variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of the preset 2D SAXS spectrum;
an updating module 303, configured to update the preset 2D SAXS spectrum according to the first 2D SAXS spectrum when the variation is greater than a preset threshold;
a determining module 304, configured to determine the first 2D SAXS map as a target 2D SAXS map when the variation is less than or equal to the preset threshold.
Optionally, as an implementation manner, the updating module 303 is further configured to generate a second 2D SAXS map according to the preset distribution parameter when the variation is greater than the preset threshold, and after the update of the preset 2D SAXS map is finished, and update the image content of the first 2D SAXS map to the image content of the second 2D SAXS map.
Optionally, as an implementation manner, the generating module 301 is specifically configured to determine first model data of N scatterers according to the preset distribution parameter, where N is a positive integer; the first 2D SAXS map is generated from the first model data.
Optionally, as an implementation manner, the updating module 303 is specifically configured to determine second model data of M scatterers according to the preset distribution parameter, where M is a positive integer; and generating a second 2D SAXS atlas according to the second model data.
Optionally, as an implementation manner, the updating module 303 is specifically configured to add the pixel intensity values of the corresponding pixel points on the first 2D SAXS spectrum and the preset 2D SAXS spectrum, and then average the added pixel intensity values to obtain the updated preset 2D SAXS spectrum.
Optionally, as an implementation manner, the generating module 301 is specifically configured to respectively establish five first matrices for the shape, the long axis, the short axis, the zenith angle and the attitude of N scatterers in the first model data, where each scatterer in the N scatterers includes a set of shape, the long axis, the short axis, the zenith angle and the attitude data; the first 2D SAXS profile is calculated from the five first matrices.
Optionally, as an implementation manner, the generating module 301 is specifically configured to respectively establish five second matrices for the shape, the long axis, the short axis, the zenith angle and the attitude of M scatterers in the second model data, where each scatterer in the M scatterers includes a set of shape, long axis, short axis, zenith angle and attitude data; and calculating the second 2D SAXS map according to the five second matrixes.
It should be noted that the implementation of the operations of the respective modules in the apparatus 300 may also correspond to the corresponding description in the method embodiment shown in fig. 1.
Referring to fig. 4, fig. 4 is a schematic structural diagram of another apparatus for calculating a 2D SAXS map according to an embodiment of the present application; as shown in fig. 4, the apparatus 400 for calculating a 2D SAXS profile includes the following modules.
The model data obtaining module 401 is configured to determine the first model data of the N scatterers according to the preset distribution parameters, and determine the second model data of the M scatterers according to the preset distribution parameters, where N and M are positive integers.
A model data forward copying module 402, configured to copy the first model data and the second model data stored in the CPU to the GPU.
A multithreaded parallel computing module 403, configured to generate the first 2D SAXS map according to the first model data and by using GPU parallel computing.
A target 2D SAXS profile determination module 404, configured to determine a target 2D SAXS profile according to the first 2D SAXS profile and the preset 2D SAXS profile.
A target 2D SAXS spectrum reverse pass back module 405, configured to reverse-loop the target 2D SAXS spectrum from the GPU to the CPU.
It should be noted that, the implementation of the operations of each module of the apparatus 400 may also correspond to the corresponding description in the method embodiment shown in fig. 2, which is not repeated herein.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device 500 for calculating a 2D SAXS map according to an embodiment of the present application, as shown in fig. 5, the electronic device 500 includes a communication interface 501, a processor 502, a memory 503, and at least one communication bus 504 for connecting the communication interface 501, the processor 502, and the memory 503.
Memory 503 includes, but is not limited to, random access memory (random access memory, RAM), read-only memory (ROM), erasable programmable read-only memory (erasable programmable read only memory, EPROM), or portable read-only memory (compact disc read-only memory, CD-ROM), and memory 503 is used for associated instructions and data.
The communication interface 501 is used to receive and transmit data.
The processor 502 may be one or more central processing units (central processing unit, CPU), and in the case where the processor 502 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.
The processor 502 in the electronic device 500 is configured to read one or more program codes stored in the memory 503, and perform the following operations: generating a first 2D SAXS map based on a GPU parallel computing technology according to a preset distribution parameter, and comparing the variation of the average pixel intensity value of the first 2D SAXS map relative to the average pixel intensity value of the preset 2D SAXS map: updating the preset 2D SAXS map according to the first 2D SAXS map when the variation is greater than a preset threshold; and when the variation is smaller than or equal to the preset threshold, determining the first 2D SAXS map as a target 2D SAXS map.
It should be noted that the implementation of each operation of the electronic device 500 may also correspond to the corresponding description of the method embodiment in fig. 1.
The embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, which when run on a terminal, implements the method flow shown in the method embodiments described above.
The embodiments of the present application also provide a computer program product, which when run on a terminal, implements the method flows shown in the method embodiments described above.
It should be appreciated that the processors referred to in the embodiments of the present application may be central processing units (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It should also be understood that the memory referred to in the embodiments of the present application may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (Double Data Rate SDRAM), enhanced SDRAM (ESDRAM), synchronous DRAM (SLDRAM), and Direct RAM (DR RAM).
Note that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, the memory (storage module) is integrated into the processor.
It should be noted that the memory described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be understood that, in various embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus and units described above may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The modules in the device of the embodiment of the application can be combined, divided and deleted according to actual needs.
The above embodiments are merely for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (8)

1. The two-dimensional small-angle X-ray scattering 2D SAXS spectrum calculation method is applied to electronic equipment and is characterized by comprising the following steps of:
determining first model data of N scatterers according to preset distribution parameters, wherein the preset distribution parameters comprise the shapes, the sizes and the angle distribution parameters of the N scatterers, and the shapes of the N scatterers are identical; the preset distribution parameters are randomly generated in a value range obtained from experiments according to a random uniform function; the first model data comprises N groups of shape, size and angle values, the N scatterers are in one-to-one correspondence with the N groups of shape, size and angle values, the N groups of size and angle values are generated by respectively inputting the size and angle distribution parameters into corresponding distribution functions, the N groups of shape values are generated from a certain value range of undetermined coefficients in the shape functions corresponding to the N scatterers according to random uniform distribution functions, and N is a positive integer;
respectively establishing five first matrixes according to N groups of shape, long axis size, short axis size, zenith angle and attitude angle data in the first model data in a function library of numerical calculation, determining the number of threads which are simultaneously opened by the GPU according to the size of the 2DSAXS spectrum and the maximum number of threads supported by a single stream processor of the GPU equipment, and simultaneously calculating the pixel value of each pixel point in the 2DSAXS spectrum according to the threads which are simultaneously opened by the GPU and the first matrixes to obtain a first 2D SAXS spectrum;
calculating the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of a preset 2D SAXS spectrum;
updating the preset 2D SAXS map according to the first 2D SAXS map when the variation is greater than a preset threshold;
and when the variation is smaller than or equal to the preset threshold, determining the first 2D SAXS map as a target 2D SAXS map.
2. The method of claim 1, wherein the computing method further comprises:
when the variation is larger than the preset threshold, and after the preset 2D SAXS map is updated, generating a second 2D SAXS map according to the preset distribution parameters;
updating the image content of the first 2D SAXS profile to the image content of the second 2D SAXS profile.
3. The method of claim 2, wherein generating a second 2D SAXS profile from the preset distribution parameters comprises:
determining second model data of M scatterers according to the preset distribution parameters, wherein M is a positive integer;
and generating a second 2D SAXS atlas according to the second model data.
4. A method according to any one of claims 1-3, wherein said updating said preset 2D SAXS profile comprises:
and adding the pixel intensity values of the corresponding pixel points on the first 2D SAXS spectrum and the preset 2D SAXS spectrum, and then taking an average value to obtain the updated preset 2D SAXS spectrum.
5. The method of claim 3, wherein the generating a second 2D SAXS map from the second model data comprises:
respectively establishing five second matrixes of the shapes, the long axes, the short axes, the zenith angles and the attitude angles of M scattering bodies in the second model data, wherein each scattering body in the M scattering bodies comprises a group of shape, long axes, short axes, zenith angles and attitude angle data;
and calculating the second 2D SAXS map according to the five second matrixes.
6. An apparatus for computing a 2D SAXS profile, the apparatus comprising:
the generating module is used for determining first model data of N scattering bodies according to preset distribution parameters, wherein the preset distribution parameters comprise the shapes, the sizes and the angle distribution parameters of the N scattering bodies, and the shapes of the N scattering bodies are the same; the preset distribution parameters are randomly generated in a value range obtained from experiments according to a random uniform function; the first model data comprises N groups of shape, size and angle values, the N scatterers are in one-to-one correspondence with the N groups of shape, size and angle values, the N groups of size and angle values are generated by respectively inputting the size and angle distribution parameters into corresponding distribution functions, the N groups of shape values are generated from a certain value range of undetermined coefficients in the shape functions corresponding to the N scatterers according to random uniform distribution functions, and N is a positive integer;
the generating module is further configured to respectively establish five first matrices according to N groups of shape, major axis size, minor axis size, zenith angle and attitude angle data in the first model data in the function library of the numerical computation function, determine the number of threads that the GPU is simultaneously turned on according to the size of the 2DSAXS spectrum and the maximum number of threads supported by a single stream processor of the GPU device, and simultaneously calculate pixel values of each pixel point in the 2DSAXS spectrum according to the threads that the GPU is simultaneously turned on and the first matrices to obtain a first 2D SAXS spectrum;
the calculating module is used for calculating the variation of the average pixel intensity value of the first 2D SAXS spectrum relative to the average pixel intensity value of a preset 2D SAXS spectrum;
an updating module, configured to update the preset 2D SAXS spectrum according to the first 2D SAXS spectrum when the variation is greater than a preset threshold;
and the determining module is used for determining the first 2D SAXS map as a target 2D SAXS map when the variation is smaller than or equal to the preset threshold value.
7. An electronic device, comprising: a processor and a memory;
the processor is connected to the memory, wherein the memory is adapted to store program code, and the processor is adapted to invoke the program code to perform the method according to any of claims 1-5.
8. A computer storage medium storing a computer program comprising program instructions which, when executed by a processor, perform the method of any one of claims 1-5.
CN202010817053.8A 2020-08-12 2020-08-12 2D SAXS map calculation method and device Active CN112037183B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010817053.8A CN112037183B (en) 2020-08-12 2020-08-12 2D SAXS map calculation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010817053.8A CN112037183B (en) 2020-08-12 2020-08-12 2D SAXS map calculation method and device

Publications (2)

Publication Number Publication Date
CN112037183A CN112037183A (en) 2020-12-04
CN112037183B true CN112037183B (en) 2023-07-28

Family

ID=73578096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010817053.8A Active CN112037183B (en) 2020-08-12 2020-08-12 2D SAXS map calculation method and device

Country Status (1)

Country Link
CN (1) CN112037183B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579969B (en) * 2020-12-21 2022-06-17 深圳大学 Two-dimensional small-angle X-ray scattering map calculation method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102498168A (en) * 2009-09-18 2012-06-13 旭化成电子材料株式会社 Electrolyte emulsion and process for producing same
CN107589136A (en) * 2016-07-08 2018-01-16 中国科学院化学研究所 The dual model approximating method and system of a kind of small angle X ray scattering
CN107589133A (en) * 2016-07-08 2018-01-16 中国科学院化学研究所 A kind of method and system that high-performance fiber is analyzed using SAXS
CN107590296A (en) * 2016-07-08 2018-01-16 深圳大学 A kind of Full _ pattern fitting method and system of small angle X ray scattering
CN110334731A (en) * 2019-05-09 2019-10-15 云南大学 A kind of the extraction of spatial information method, apparatus and electronic equipment of spectrum picture

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102498168A (en) * 2009-09-18 2012-06-13 旭化成电子材料株式会社 Electrolyte emulsion and process for producing same
CN107589136A (en) * 2016-07-08 2018-01-16 中国科学院化学研究所 The dual model approximating method and system of a kind of small angle X ray scattering
CN107589133A (en) * 2016-07-08 2018-01-16 中国科学院化学研究所 A kind of method and system that high-performance fiber is analyzed using SAXS
CN107590296A (en) * 2016-07-08 2018-01-16 深圳大学 A kind of Full _ pattern fitting method and system of small angle X ray scattering
CN110334731A (en) * 2019-05-09 2019-10-15 云南大学 A kind of the extraction of spatial information method, apparatus and electronic equipment of spectrum picture

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PAN基碳纤维的微观结构与力学性能相关性分析;井敏;谭婷婷;王成国;冯志海;杨云华;;航空材料学报(第01期);第1-3页 *

Also Published As

Publication number Publication date
CN112037183A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
Chen et al. Improving point selection in cubature by a new discrepancy
Fan et al. An advanced coarse-grained nucleosome core particle model for computer simulations of nucleosome-nucleosome interactions under varying ionic conditions
CN111783338B (en) Microstructure metal intensity distribution prediction method and device based on artificial intelligence
Haiduk et al. Saturated packings of convex anisotropic objects under random sequential adsorption protocol
CN112037183B (en) 2D SAXS map calculation method and device
Escoda et al. Three‐dimensional morphological modelling of concrete using multiscale Poisson polyhedra
CN112037181B (en) 2D SAXS (three dimensional architecture) atlas analysis model training method and device
Wang et al. A novel Arcs-based discrete element modeling of arbitrary convex and concave 2D particles
Hendriks et al. Implementation of traction constraints in Bragg‐edge neutron transmission strain tomography
Hinsch et al. Quantitative tube model for semiflexible polymer solutions
Zhang et al. Three‐dimensional quantitative analysis on granular particle shape using convolutional neural network
Burian et al. Dummy-atom modelling of stacked and helical nanostructures from solution scattering data
CN112579969B (en) Two-dimensional small-angle X-ray scattering map calculation method and device
Daga et al. Towards accelerating molecular modeling via multi-scale approximation on a GPU
Song et al. Effect of the reaction field on molecular forces and torques revealed by an image-charge solvation model
Kumar et al. Pivotal Roles of Triple Screening-Topological, Electrostatic, and Hydrodynamic-On Dynamics in Semidilute Polyelectrolyte Solutions
WO2020203551A1 (en) Feature quantity calculating method, feature quantity calculating program and feature quantity calculating device, screening method, screening program and screening device, compound creating method, compound creating program and compound creating device
Haita Particle-mesh two-dimensional pattern reverse Monte Carlo analysis on filled-gels during uniaxial expansion
Martinez-Sanchez et al. Simulating the cellular context in synthetic datasets for cryo-electron tomography
Bouchbinder et al. Statistical physics of fracture surfaces morphology
Zhou et al. Memory-efficient volume ray tracing on GPU for radiotherapy
Ikonnikova et al. Reconstruction of 3D structure for nanoscale biological objects from experiments data on super-bright X-ray free electron lasers (XFELs): Dependence of the 3D resolution on the experiment parameters
Ermilov et al. Secondary structure of globules of copolymers consisting of amphiphilic and hydrophilic units: Effect of potential range
Ueda Applicable scope of estimation of three-dimensional particle size distribution by the Goldsmith-Cruz-Orive and improved methods
Saseendran et al. Unlocking the potential: analyzing 3D microstructure of small-scale cement samples from space using deep learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant