Spectral redshift measurement method, apparatus, device, and medium
By constructing a three-dimensional tensor data structure and using numerical computing libraries such as NumPy and PyTorch to perform spectral redshift measurements, efficient parallel processing was achieved, solving the problems of low utilization of computing resources and technology silos in existing technologies, and improving processing speed and accuracy.
Patent Information
- Application Number
- CN202511881365.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-15
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2045-12-15
AI Technical Summary
Existing technologies cannot effectively utilize the massive parallel computing capabilities of modern multi-core CPUs and GPUs when processing large-scale spectral data, and lack integration with artificial intelligence frameworks and cloud-native technology stacks, resulting in low utilization of computing resources and technology silos.
By adopting a hybrid computing approach, combining numerical computing libraries such as NumPy and PyTorch or TensorFlow, a three-dimensional tensor data structure is constructed, and batch tensor operations are performed using parallel computing hardware to achieve parallel processing of spectral redshift measurements.
It achieves efficient utilization of modern parallel computing resources, improves the processing speed and accuracy of spectral redshift measurement, ensures numerical consistency with traditional scientific computing, and solves the problems of low utilization of computing resources and technology silos.
Smart Images

Figure CN121323799B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of astronomical information and high-performance computing, and more particularly to a method and device for measuring spectral redshift, and a medium. BACKGROUND
[0002] Spectral redshift of celestial bodies is a key parameter for cosmological research and astrophysical analysis. Currently, large-scale spectral sky survey projects (such as LAMOST, SDSS, DESI) have generated a large amount of spectral data, and the traditional serial processing method based on commercial closed-source software such as IDL has become a bottleneck for data processing. These traditional solutions have two inherent defects: first, the core algorithm is a serial structure with three nested loops, which cannot effectively utilize the large-scale parallel computing power of modern multi-core CPUs and GPUs, resulting in very low utilization of computing resources; second, the technology ecology is closed, and cannot be integrated with modern artificial intelligence frameworks represented by PyTorch / TensorFlow and cloud-native technology stacks, forming a "technology island".
[0003] Some existing Python-based transplantation attempts often only rewrite the IDL code simply, and fail to fundamentally solve the problem of algorithm parallelization, and lack a mechanism to ensure numerical consistency with the traditional algorithm that has been scientifically verified. Therefore, there is an urgent need in the field for a high-performance solution that can inherit the rigor of traditional scientific computing while embracing modern parallel computing and AI technology. SUMMARY
[0004] In view of the above problems, the present application provides a method and device for measuring spectral redshift, and a medium.
[0005] According to a first aspect of the present application, a method for measuring spectral redshift is provided, the method comprising: receiving N pieces of observed spectral data to be measured;
[0006] determining a processing mode for the observed spectral data, the processing mode comprising a first processing mode and a second processing mode;
[0007] in response to the processing mode being the first processing mode, processing the observed spectral data through a first calculation path, the first calculation path performing redshift measurement calculation by matching the observed spectral data with a set of template spectral data based on a first numerical calculation library, and the calculation result of the first numerical calculation library being consistent with the calculation result of a reference algorithm within a predetermined accuracy range;
[0008] in response to the processing mode being the second processing mode, processing the observed spectral data through a second computing path, the second computing path reconstructing the matching calculation of the observed spectral data with the template spectral data into a tensor parallel model and executing on parallel computing hardware based on a second numerical computing library that supports tensor operations.
[0009] According to embodiments of the present application, the first numerical computing library is NumPy, and the benchmark algorithm is a serial redshift measurement algorithm implemented in IDL language; and / or, the second numerical computing library is PyTorch or TensorFlow.
[0010] According to embodiments of the present application, the processing of the spectral data through the second computing path includes:
[0011] The N pieces of observed spectral data, M pieces of spectral template data, and the matching calculation at L redshift offset points are constructed into a three-dimensional tensor data structure with dimensions of [N, M, L];
[0012] The three-dimensional tensor data structure is loaded into the parallel computing hardware;
[0013] A batch tensor operation is performed on the three-dimensional tensor data structure using the second numerical computing library to calculate the matching degree statistics at all [N, M, L] nodes in a parallel manner at one time;
[0014] The batch tensor operation includes a batch matrix multiplication and a batch linear least square solution.
[0015] According to embodiments of the present application, the matching degree statistics is a chi-square statistic, and the calculation of the matching degree statistics at all [N, M, L] nodes in a parallel manner at one time includes:
[0016] For each node, the following operations S1 and S2 are performed in parallel:
[0017] S1, using a polynomial basis function to perform continuous spectral fitting on the template spectrum under single-precision floating-point numbers;
[0018] S2, calculating a chi-square value based on the fitted template spectrum and the observed spectrum under double-precision floating-point numbers.
[0019] According to embodiments of the present application, the method further includes:
[0020] A plurality of discrete computing operations involved in the calculation of the chi-square statistic are fused into a unified GPU computing kernel;
[0021] The plurality of discrete computing operations at least include: a resampling operation of the template spectral data under a redshift offset, a continuous spectral fitting operation based on a polynomial basis function, and a residual sum of squares calculation operation between the observed spectral data and the fitted template spectral data.
[0022] According to an embodiment of the present application, when the video memory of the parallel computing hardware cannot process the entire [N, M, L] three-dimensional tensor data structure at one time, the method comprises:
[0023] According to the current available video memory size, the three-dimensional tensor data structure is divided into a plurality of sub-tensors with a size of [Chunk_N, M, L] in the spectral dimension, wherein Chunk_N < N; each of the sub-tensors is sequentially loaded into the video memory and calculated.
[0024] According to an embodiment of the present application, after all the matching degree statistics on the [N, M, L] nodes are calculated at one time in a parallel manner, the method further comprises:
[0025] A three-dimensional response surface is constructed with the negative value or the reciprocal of the matching degree statistics as the response value.
[0026] A three-dimensional model is fitted to the three-dimensional response surface region containing the global maximum point and the neighborhood of the global maximum point using a three-dimensional elliptical Gaussian function model, and the peak position of the three-dimensional model is obtained.
[0027] The template type and the redshift offset point corresponding to the peak position of the three-dimensional model are determined as the final celestial body classification result and the redshift value.
[0028] A second aspect of the present application provides a spectral redshift measurement device, comprising: a receiving module configured to receive N pieces of observed spectral data to be measured; a determining module configured to determine a processing mode for the observed spectral data, the processing mode comprising a first processing mode and a second processing mode; a first processing module configured to, in response to the processing mode being the first processing mode, process the observed spectral data through a first calculation path, the first calculation path performing redshift measurement calculation by matching the observed spectral data with a set of template spectral data based on a first numerical calculation library, and the calculation result of the first numerical calculation library being consistent with the calculation result of a reference algorithm within a predetermined accuracy range; and a second processing module configured to, in response to the processing mode being the second processing mode, process the observed spectral data through a second calculation path, the second calculation path reconstructing the redshift measurement calculation into a tensor parallel model based on a second numerical calculation library and executing on parallel computing hardware, the second numerical calculation library supporting tensor operations.
[0029] According to a third aspect of the present application, there is provided an electronic device comprising: one or more processors; memory for storing one or more computer programs, the one or more processors executing the one or more computer programs to implement the steps of the method according to the first aspect.
[0030] According to a fourth aspect of the present application, there is provided a computer readable storage medium having stored thereon computer programs or instructions, which when executed by a processor implement the steps of the method according to the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0031] The above and other aspects, features and advantages of the present application will become more apparent from the following description of embodiments of the present application taken in conjunction with the accompanying drawings, in which:
[0032] Figure 1 a flow chart of a method of spectral red shift measurement according to embodiments of the present application is schematically shown;
[0033] Figure 2 a block diagram of a spectral red shift measurement apparatus according to embodiments of the present application is schematically shown; and
[0034] Figure 3 a block diagram of an electronic device suitable for implementing spectral red shift measurement according to embodiments of the present application is schematically shown. DETAILED DESCRIPTION
[0035] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. It is to be understood, however, that the description is merely exemplary of the present application, and is intended to provide a thorough description for those skilled in the art to understand the present application. Therefore, the description is not intended to limit the scope of the present application. In the following detailed description of the embodiments of the present application, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring the concepts of the present application.
[0036] The terms used herein are merely used to describe specific embodiments, and are not intended to limit the present application. The terms "include" and "have" and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0037] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present description, and should not be interpreted in an idealized or excessively formal manner.
[0038] In the case of using expressions such as "at least one of A, B, and C", it generally should be interpreted to include any of A, B, or C alone, as well as a combination of A, B, and / or C. For example, "a system having at least one of A, B, and C" should be interpreted to include a system having A alone, a system having B alone, a system having C alone, a system having both A and B, a system having both A and C, a system having both B and C, and / or a system having A, B, and C.
[0039] Figure 1 A flowchart of a spectral redshift measurement method according to an embodiment of the present application is schematically shown.
[0040] As shown in Figure 1 , the spectral redshift measurement method of this embodiment includes operations S210-S240.
[0041] At operation S210, N pieces of observation spectral data to be measured are received.
[0042] According to an embodiment of the present application, the observation spectral data can come from an astronomical telescope and a spectrometer, and be stored in a standardized data format, such as a FITS file. Each piece of observation spectral data contains two core arrays: a wavelength sequence and a corresponding flux value sequence. The receiving process includes reading these files from a file system or a network interface, and parsing the data into array structures available for computation in memory. Parameter N represents the total number of pieces of observation spectral data in the current processing task, which is an integer greater than or equal to 1.
[0043] At operation S220, a processing mode for the observation spectral data is determined.
[0044] According to an embodiment of the present application, the processing mode includes a first processing mode and a second processing mode. The processing mode is a state variable that determines the computing behavior.
[0045] The first processing mode can be understood as a high-precision verification mode. In this mode, the system prioritizes the numerical precision and traceability of the computing results, and is usually used for algorithm verification, final check before scientific data release, or fallback computation in the absence of high-performance hardware environment.
[0046] The second processing mode can be understood as a high-performance throughput mode. In this mode, the system prioritizes the data processing speed, and is usually used for rapid processing and preliminary analysis of massive sky survey data.
[0047] The determination of the processing mode can be based on at least one of the following ways:
[0048] User explicit specification: The mode is directly set by the user through command line parameters, configuration files, or API call parameters.
[0049] System automatic decision: the system detects the current available hardware resources. For example, by querying the system environment, if a GPU is found to be available, the second processing mode is automatically selected; otherwise, the first processing mode is rolled back.
[0050] Data volume trigger: when the number of received spectral data N exceeds a certain preset threshold (for example, N>1000), the second processing mode is automatically enabled to improve efficiency.
[0051] In operation S230, in response to the processing mode being the first processing mode, the spectral data is processed through the first calculation path.
[0052] According to an embodiment of the present application, the first calculation path performs redshift measurement calculation based on a first numerical calculation library by matching the observed spectral data with a set of template spectral data to obtain a calculation result, and the calculation result of the first numerical calculation library is consistent with the calculation result of a reference algorithm within a predetermined accuracy range.
[0053] According to an embodiment of the present application, the first numerical calculation library can refer to the NumPy library of Python. NumPy can provide powerful multi-dimensional array objects and a series of advanced mathematical functions, and can perform calculations in a vectorized manner to avoid inefficient Python loops, thereby maintaining code simplicity while achieving speeds close to compiled languages.
[0054] According to an embodiment of the present application, the reference algorithm can refer to a serial redshift measurement algorithm that has been scientifically verified through long-term practice in the field and serves as a comparison reference. In one embodiment, the reference algorithm can be a template matching algorithm implemented by the IDL language. The core is to calculate the chi-square statistic by sliding the template, and find the minimum value point to determine the redshift.
[0055] According to an embodiment of the present application, the first calculation path is an exact reproduction of the reference algorithm on NumPy. When implemented, the loops and operations in the original IDL algorithm need to be translated into equivalent NumPy vectorized operations one by one and accurately. Ensure the complete consistency of the algorithm logic.
[0056] According to an embodiment of the present application, the consistency within the predetermined accuracy range can mean that the difference between the output results (mainly the redshift value z) of the first calculation path and the output results of the reference algorithm is controlled within a very small range. In one embodiment, the calculation can be performed under 64-bit double-precision floating-point numbers, and the difference between the two results is only in the order of machine precision, i.e. about 10^{-14} to 10^{-16} relative error or absolute error. This consistency can be achieved by accurately translating the algorithm line by line and ensuring the numerical behavior of all intermediate calculation steps (such as interpolation, matrix inversion, normalization, etc.).
[0057] According to the embodiments of the present application, the first calculation path includes inverse variance calculation and chi-square statistic calculation. The inverse variance calculation and the chi-square statistic calculation can be performed under double-precision floating-point numbers. The inverse variance calculation and the chi-square statistic calculation are performed under single-precision floating-point numbers.
[0058] In operation S240, in response to the processing mode being the second processing mode, the observed spectral data is processed through the second calculation path.
[0059] According to the embodiments of the present application, the second calculation path reconstructs the redshift measurement calculation into a tensor parallel model based on a second numerical calculation library supporting tensor operation, and performs the redshift measurement calculation on parallel computing hardware.
[0060] According to the embodiments of the present application, reconstructing the redshift measurement calculation into a tensor parallel model means completely changing the original algorithm from a serial thinking of triple for loops to a parallel thinking based on tensor operation.
[0061] According to the embodiments of the present application, the parallel computing hardware mainly refers to a graphics processing unit or a tensor processing unit. These hardware have thousands of computing cores and are designed for processing a large number of similar computing tasks at the same time.
[0062] According to the embodiments of the present application, through the above-mentioned dual-path design, the user can flexibly select the most suitable calculation path according to different requirements for precision, speed or hardware environment when processing the observed spectral data. The first path ensures the numerical consistency with the scientific heritage and plays a benchmark verification and bottom protection role. The second path uses modern tensor calculation and GPU hardware to realize the extreme of processing efficiency. The two coexist in a unified technical base to realize the coexistence of precision and performance in the field of scientific calculation.
[0063] In some embodiments, the N pieces of observed spectral data, the M pieces of spectral template data, and the matching calculation at the L redshift offset points can be constructed into a three-dimensional tensor data structure with dimensions of [N, M, L]; the three-dimensional tensor data structure is loaded into parallel computing hardware; and the second numerical calculation library is used to perform batch tensor operation on the three-dimensional tensor data structure to calculate the matching degree statistics of all [N, M, L] nodes in a parallel manner at one time. The second numerical calculation library can automatically map the above-mentioned [N, M, L] dimensional tensor calculation task to thousands of cores of the GPU for parallel execution, thereby completely eliminating the triple loop and improving the performance by orders of magnitude.
[0064] For example, the system can first pre-process the N observed spectral data and M template spectral data (e.g. normalization, resampling to log wavelength coordinate). Then, for each redshift shift point k (0≤k<L), it is equivalent to shift the template by a fixed pixel interval on the wavelength axis. Finally, the combination of all N spectra, M templates, and L redshift points forms a three-dimensional computational space, which can be represented by a tensor of [N, M, L]. This tensor can be understood as three dimensions of "data batch", "template type", and "redshift trial value".
[0065] For example, in PyTorch, loading parallel computing hardware can be achieved by a simple.cuda() method call, such as tensor_gpu = tensor_cpu.cuda(). This step can copy the three-dimensional tensor data in the main memory (RAM) to the GPU's video memory, preparing for subsequent parallel computing.
[0066] The traditional loop calculates N*M*L nodes one by one, while the present embodiment calculates the N*M*L nodes as a whole. The traditional loop calculates np.sum((spectrum[i]-template_j_shifted[k])**2 / variance[i]) for each (i,j,k). The batch tensor operation can expand the observed spectral data to [N,1,1,W] dimensions and the observed template data to [1,M,L,W] dimensions (W is the number of wavelength points), use the broadcast mechanism of PyTorch to perform element-wise subtraction, squaring, and dividing by variance, and finally sum in the wavelength dimension (torch.sum(..., dim=-1)) to get a [N,M,L] dimensional chi-square statistic tensor at once. This process completely avoids Python-level loops and is completed in parallel on the GPU by highly optimized CUDA kernels.
[0067] In some embodiments, the matching degree statistic is the chi-square statistic, which can be calculated in parallel for each node using a polynomial basis function to perform continuous spectral fitting on the template spectrum, and based on the fitted template spectrum and the observed spectrum.
[0068] Although each node logically needs to perform continuous spectral fitting and chi-square calculation, in the constructed [N,M,L] three-dimensional tensor model, these operations can be performed on all nodes simultaneously through tensor operations, rather than loops. This realizes the transformation from logical individual operations to physical parallel execution.
[0069] In some embodiments, a plurality of discrete computing operations involved in calculating the chi-square statistic can be fused into a unified GPU computing kernel to reduce the read-write overhead of the GPU global memory.
[0070] The plurality of discrete computing operations include at least a resampling operation of the template spectral data at a redshift offset, a continuous spectral fitting operation based on polynomial basis functions, and a residual sum of squares computation operation between the observed spectral data and the fitted template spectral data.
[0071] In some embodiments, the batch tensor operation includes a batch matrix multiplication and a batch linear least square solution.
[0072] In some embodiments, the three-dimensional tensor data structure can be divided into a plurality of sub-tensors with a size of [Chunk_N, M, L] in the spectral dimension according to a current available GPU memory size, where Chunk_N < N; each sub-tensor is sequentially loaded into the GPU memory and computed.
[0073] For example, the system can create a loop to take out Chunk_N pieces of observed spectral data from N pieces of observed spectral data each time, construct a sub-tensor with a size of [Chunk_N, M, L], and send it to the GPU for parallel computation. After the sub-tensor is computed and the result is retrieved, the next sub-tensor is processed until all the observed spectral data are processed. The contradiction between the parallel computing advantage of the GPU and the limited GPU memory resources is balanced.
[0074] In some embodiments, after the matching degree statistics of all [N, M, L] nodes are computed in parallel, a three-dimensional response surface can be constructed using the negative or reciprocal of the matching degree statistics as the response value; a three-dimensional elliptical Gaussian function model is used to fit the three-dimensional response surface region containing the global maximum point and the neighborhood of the global maximum point to obtain the peak position of the three-dimensional model; the template type and the redshift offset point corresponding to the peak position of the three-dimensional model are determined as the celestial body classification result and the redshift value.
[0075] In some embodiments, the same set of observed spectral data can be processed through the first computing path and the second computing path respectively; the difference between the redshift measurement results output by the first computing path and the second computing path is compared to obtain a difference result; when the difference result exceeds a preset tolerance, an alarm is triggered or a log is recorded.
[0076] Based on the above spectral redshift measurement method, the present application further provides a spectral redshift measurement device. The following will be described in detail Figure 2 The spectral redshift measurement device will be described in detail.
[0077] Figure 2 The structure block diagram of the spectral redshift measurement device according to the embodiments of the present application is schematically shown.
[0078] As Figure 2As shown, the spectrum redshift measurement apparatus of the embodiment includes a receiving module 310, a determining module 320, a first processing module 330 and a second processing module 340.
[0079] The receiving module 310 is configured to receive N pieces of observation spectrum data to be measured. In an embodiment, the receiving module 310 can be configured to perform the operation S210 described above, and details are not repeated here.
[0080] The receiving module 320 is configured to receive N pieces of observation spectrum data to be measured. In an embodiment, the receiving module 320 can be configured to perform the operation S220 and the operation S230 described above, and details are not repeated here.
[0081] The first processing module 330 is configured to, in response to the processing mode being a first processing mode, process the observation spectrum data through a first calculation path, the first calculation path performing a redshift measurement calculation by matching the observation spectrum data with a set of template spectrum data based on a first numerical calculation library, and a calculation result of the first numerical calculation library being consistent with a calculation result of a reference algorithm within a predetermined accuracy range. In an embodiment, the first processing module 330 can be configured to perform the operation S330 described above, and details are not repeated here.
[0082] The second processing module 340 is configured to, in response to the processing mode being a second processing mode, process the observation spectrum data through a second calculation path, the second calculation path reconstructing the redshift measurement calculation into a tensor parallel model and performing on parallel computing hardware based on a second numerical calculation library supporting tensor operations. In an embodiment, the second processing module 340 can be configured to perform the operation S240 described above, and details are not repeated here.
[0083] According to the embodiment of the present application, the first numerical calculation library is NumPy, the reference algorithm is a serial redshift measurement algorithm implemented by IDL language, the first calculation path includes inverse variance calculation and chi-square statistic calculation, and the processing of the observation spectrum data through the first calculation path includes: performing the inverse variance calculation and the chi-square statistic calculation under double-precision floating-point numbers; and performing the inverse variance calculation and the chi-square statistic calculation under single-precision floating-point numbers.
[0084] According to the implementation of the present application, processing the spectral data through the second calculation path comprises: constructing a three-dimensional tensor data structure with dimensions of [N, M, L] by matching calculation of N pieces of observed spectral data, M pieces of spectral template data, and L redshift offset points; loading the three-dimensional tensor data structure into parallel computing hardware; using a second numerical calculation library to perform batch tensor operation on the three-dimensional tensor data structure to calculate the matching degree statistics of all [N, M, L] nodes at one time in a parallel manner, wherein the batch tensor operation comprises batch matrix multiplication and batch linear least square solution.
[0085] According to the implementation of the present application, the matching degree statistics is a chi-square statistic, and calculating the matching degree statistics of all [N, M, L] nodes at one time in a parallel manner comprises: for each node, performing continuous spectral fitting on the template spectrum using a polynomial basis function in parallel, and calculating the chi-square value based on the fitted template spectrum and the observed spectrum.
[0086] According to the implementation of the present application, the device is further configured to: fuse a plurality of discrete calculation operations involved in calculating the chi-square statistics into a unified GPU calculation kernel; wherein the plurality of discrete calculation operations at least comprise: resampling operation of the template spectrum data under the redshift offset, continuous spectral fitting operation based on the polynomial basis function, and residual sum of squares calculation operation between the observed spectrum data and the fitted template spectrum data.
[0087] According to the implementation of the present application, when the video memory of the parallel computing hardware cannot process the entire [N, M, L] three-dimensional tensor data structure at one time, the device is further configured to: divide the three-dimensional tensor data structure into a plurality of sub-tensors with a size of [Chunk_N, M, L] in the spectral dimension according to the current available video memory size, wherein Chunk_N < N; and sequentially load each sub-tensor into the video memory and perform calculation.
[0088] According to the implementation of the present application, the device is further configured to: construct a three-dimensional response surface with the negative value or the reciprocal of the matching degree statistics as the response value; fit a three-dimensional model of the region of the three-dimensional response surface containing the global maximum point and the neighborhood of the global maximum point using a three-dimensional elliptical Gaussian function model to obtain the peak position of the three-dimensional model; and determine the template type and the redshift offset point corresponding to the peak position of the three-dimensional model as the celestial body classification result and the redshift value.
[0089] According to an embodiment of the present application, any of the receiving module 310, the determining module 320, the first processing module 330 and the second processing module 340 can be combined in one module, or any of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of other modules, and implemented in one module. According to an embodiment of the present application, at least one of the receiving module 310, the determining module 320, the first processing module 330 and the second processing module 340 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of hardware or firmware that can be integrated or packaged with a circuit, or implemented in any one of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the receiving module 310, the determining module 320, the first processing module 330 and the second processing module 340 can be at least partially implemented as a computer program module that can perform corresponding functions when it is run.
[0090] Figure 3 A block diagram of an electronic device suitable for implementing the method of spectral redshift measurement according to an embodiment of the present application is schematically shown.
[0091] As shown in Figure 3 , the electronic device according to an embodiment of the present application comprises a processor 401 that can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 402 or loaded from a storage portion 408 into a random access memory (RAM) 403. The processor 401 can comprise, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (such as an application specific integrated circuit (ASIC)), etc. The processor 401 can also comprise an on-board memory for cache use. The processor 401 can comprise a single processing unit or multiple processing units for performing different actions of the method processes according to embodiments of the present application.
[0092] In the RAM 403, various programs and data required for the operation of the electronic device are stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other via the bus 404. The processor 401 performs various operations of the method flow according to the embodiments of the present application by executing the programs in the ROM 402 and / or the RAM 403. It should be noted that the programs can also be stored in one or more memories other than the ROM 402 and the RAM 403. The processor 401 can also perform various operations of the method flow according to the embodiments of the present application by executing the programs stored in the one or more memories.
[0093] According to the embodiments of the present application, the electronic device can further include an input / output (I / O) interface 405, which is also connected to the bus 404. The electronic device can further include one or more of the following components connected to the input / output (I / O) interface 405: an input part 406 including a keyboard, a mouse, and the like; an output part 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a speaker, and the like; a storage part 408 including a hard disk, and the like; and a communication part 409 including a network interface card such as a LAN card, a modem, and the like. The communication part 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output (I / O) interface 405 as necessary. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is mounted on the drive 410 as necessary, so that a computer program read therefrom is installed in the storage part 408 as necessary.
[0094] The present application also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments; or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, when the one or more programs are executed, the method according to the embodiments of the present application is implemented.
[0095] According to an embodiment of the present application, the computer readable storage medium can be a non-transitory computer readable storage medium, for example, can include but not limited to: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this application, a computer readable storage medium can be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present application, the computer readable storage medium can include the ROM 402 and / or the RAM 403 described above and / or one or more memory other than the ROM 402 and the RAM 403.
[0096] Embodiments of the present application also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the spectral redshift measurement method provided by the embodiments of the present application.
[0097] The above functions defined in the system / device of the embodiments of the present application are performed when the computer program is executed by the processor 401. According to an embodiment of the present application, the system, device, module, unit, etc. described above can be implemented by computer program modules.
[0098] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal on a network medium, and be downloaded and installed through the communication part 409, and / or be installed from the detachable medium 411. The program codes contained in the computer program can be transmitted by any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
[0099] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 409, and / or be installed from the detachable medium 411. When the computer program is executed by the processor 401, the above functions defined in the system of the embodiments of the present application are performed. According to an embodiment of the present application, the system, device, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0100] According to embodiments of the present application, program code for implementing the computer programs provided by embodiments of the present application can be written in any combination of one or more programming languages, and can be implemented in a high-level procedural and / or object-oriented programming language, and / or in assembly / machine language. Programming languages include, but are not limited to, Java, C++, python, "C", or the like. Program code can execute entirely on a user's computing device, partly on the user's device, as a stand-alone software package, partly on a remote computing device, or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, such as through the Internet using an Internet Service Provider.
[0101] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0102] Those skilled in the art will appreciate that features recited in the various embodiments of the present application can be combined and / or integrated in various combinations, even if such combinations have not been explicitly recited in the present application. In particular, the features recited in the various embodiments of the present application can be combined and / or integrated in various combinations, without departing from the spirit and teachings of the present application. All such combinations are within the scope of the present application.
Claims
1. A method of measuring a spectral red shift, characterized by, The method comprises: receiving N pieces of observation spectral data to be measured, N being a positive integer; determining a processing mode for the observation spectral data, the processing mode comprising a first processing mode and a second processing mode; in response to the processing mode being the first processing mode, processing the observation spectral data through a first calculation path, the first calculation path performing a redshift measurement calculation by matching the observation spectral data with a set of template spectral data based on a first numerical calculation library, and the calculation result of the first numerical calculation library being consistent with the calculation result of a benchmark algorithm within a predetermined accuracy range; in response to the processing mode being the second processing mode, processing the observation spectral data through a second calculation path, the second calculation path reconstructing the redshift measurement calculation into a tensor parallel model and executing on parallel computing hardware based on a second numerical calculation library supporting tensor operations.
2. The method of claim 1, wherein, The first numerical calculation library is NumPy, the benchmark algorithm is a serial redshift measurement algorithm implemented in IDL language, the first calculation path includes inverse variance calculation and chi-square statistic calculation, and the method comprises: performing the inverse variance calculation and the chi-square statistic calculation under double-precision floating-point numbers; performing calculations other than the inverse variance calculation and the chi-square statistic under single-precision floating-point numbers.
3. The method of claim 1, wherein, The processing of the observation spectral data through the second calculation path comprises: constructing the N pieces of observation spectral data, M pieces of spectral template data, and matching calculation at L redshift offset points into a three-dimensional tensor data structure with a dimension of [N, M, L]; loading the three-dimensional tensor data structure into the parallel computing hardware; using the second numerical calculation library, performing batch tensor operations on the three-dimensional tensor data structure to calculate matching degree statistics on all [N, M, L] nodes in a parallel manner at one time; wherein the batch tensor operations include batch matrix multiplication and batch linear least squares solution.
4. The method of claim 3, wherein, The matching degree statistics are chi-square statistics, and the calculation of the matching degree statistics on all [N, M, L] nodes in a parallel manner at one time comprises: for each node, performing the following operations S1 and S2 in parallel: S1, performing continuous spectral fitting on the template spectrum using a polynomial basis function; S2, calculating the chi-square value based on the fitted template spectrum and the observation spectrum.
5. The method of claim 4, wherein, The method further comprises: fusing a plurality of discrete calculation operations involved in calculating the chi-square statistics into a unified GPU calculation kernel; wherein the plurality of discrete calculation operations at least include: resampling operation of the template spectral data under redshift offset, continuous spectral fitting operation based on the polynomial basis function, and residual sum of squares calculation operation between the observation spectral data and the fitted template spectral data.
6. The method of claim 3, wherein, When the video memory of the parallel computing hardware cannot process the entire [N, M, L] three-dimensional tensor data structure at one time, the method comprises: According to a current available GPU size, the three-dimensional tensor data structure is divided into a plurality of sub-tensors with a size of [Chunk_N, M, L] in the spectral dimension, wherein Chunk_N < N; Each of the sub-tensors is loaded into the GPU in sequence and calculated.
7. The method of claim 3, wherein, After the matching degree statistics of all [N, M, L] nodes are calculated at one time in a parallel manner, the method further comprises: A three-dimensional response surface is constructed with the negative value or inverse of the matching degree statistics as a response value; A three-dimensional model is fitted to a region of the three-dimensional response surface containing a global maximum point and a neighborhood of the global maximum point, to obtain a peak position of the three-dimensional model; The template type and redshift offset point corresponding to the peak position of the three-dimensional model are determined as the celestial body classification result and redshift value.
8. A spectral red shift measuring device, characterized in that The apparatus comprises: a receiving module configured to receive N pieces of observation spectrum data to be measured; a determining module configured to determine a processing mode for the observation spectrum data, the processing mode comprising a first processing mode and a second processing mode; a first processing module configured to, in response to the processing mode being the first processing mode, process the spectrum data through a first calculation path, the first calculation path performing redshift measurement calculation by matching the observation spectrum data with a set of template spectrum data based on a first numerical calculation library, and the calculation result of the first numerical calculation library being consistent with the calculation result of a reference algorithm within a predetermined accuracy range; a second processing module configured to, in response to the processing mode being the second processing mode, process the observation spectrum data through a second calculation path, the second calculation path reconstructing redshift measurement calculation into a tensor parallel model and executing on parallel computing hardware based on a second numerical calculation library, the second numerical calculation library supporting tensor operations.
9. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1-7.
10. A computer readable storage medium having stored thereon a computer program or instructions, characterized in that, The computer program or instructions, when executed by a processor, implement the steps of the method according to any one of claims 1-7.
Citation Information
Patent Citations
Astronomical cruising data processing method and system and storage medium
CN110175313A
Large-scale hyperspectral data tensor ring decomposition random sampling method based on cloud computing
CN114201453A