A method, apparatus, device, and medium for converting data formats.

By automating the processing of MDF format data to generate CSV format files, the problem of low efficiency in data parsing and conversion in the field of microwave measurement is solved, achieving efficient and accurate data processing and analysis.

CN120975041BActive Publication Date: 2026-03-06ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511498469.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-03-06
Estimated Expiration
2045-10-17

AI Technical Summary

Technical Problem

The lack of efficient and automated data parsing and conversion solutions in the field of microwave measurement leads to cumbersome, inefficient, and error-prone operations, especially when processing MDF format data.

Method used

A data format conversion method is provided, which generates a CSV format file by automatically finding and extracting the real and imaginary data in an MDF format file. This includes automatically calculating amplitude and phase values ​​and constructing frequency correspondences, thereby achieving automatic data integration and standardized storage.

Benefits of technology

It improves the efficiency and accuracy of data processing, reduces the risk of human error, simplifies the operation process, and ensures the consistency and reliability of data, making it suitable for rapid and accurate data analysis in the field of microwave measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120975041B_ABST
    Figure CN120975041B_ABST
Patent Text Reader

Abstract

This application relates to the field of data processing technology, and discloses a method, apparatus, device, and medium for converting data formats. The method includes: finding target files in MDF format for microwave measurement data; extracting real part data for amplitude and imaginary part data for phase for each target file to obtain a first data list; traversing the first data list to determine the amplitude value corresponding to the real part data and the phase value corresponding to the imaginary part data to obtain a second data list; generating the frequency corresponding to each pair of amplitude and phase values ​​in the second data list based on the number of data points in the second data list, and constructing a CSV column format to obtain a CSV format file; and reading the target data from each CSV format file one by one to generate a summary file in CSV format. The technical solution provided by this application can provide an efficient and automated solution for parsing and processing complex MDF format data in the field of microwave measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device and medium for converting data formats. Background Technology

[0002] Data processing in the microwave measurement field faces the challenge of parsing MDF formats. Existing technologies primarily rely on specialized software and manual operation, resulting in cumbersome, inefficient, and error-prone processes, especially for large-scale data processing. The lack of dedicated parsing algorithms and automated solutions for MDF formats means that data processing still requires significant manual intervention, making it difficult to meet the demands for speed and accuracy.

[0003] Therefore, there is an urgent need for an efficient automated solution to optimize the data parsing and transformation process. Summary of the Invention

[0004] This application provides a data format conversion method, apparatus, device, and medium, which solves the technical problem that the current microwave measurement field lacks efficient and automated solutions to parse and process complex MDF format data, resulting in cumbersome operation, low efficiency, and easy errors.

[0005] To achieve the above objectives, the main technical solutions adopted in this application include:

[0006] In a first aspect, embodiments of this application provide a data format conversion method, the method comprising:

[0007] Locate the target file in MDF format for microwave measurement data, and extract the real part data for representing amplitude and the imaginary part data for representing phase for each target file to obtain a first data list containing the real part data and the imaginary part data.

[0008] Traverse the first data list to determine the amplitude value corresponding to the real part data and the phase value corresponding to the imaginary part data, and obtain a second data list containing the amplitude value and the phase value;

[0009] Based on the number of data points in the second data list, generate the frequency corresponding to each pair of amplitude and phase values ​​in the second data list, and construct a CSV column format based on the frequency, amplitude value, and phase value to obtain a CSV format file that matches each target file;

[0010] Read the target data from each CSV file one by one, integrate all the target data, and generate a summary file in CSV format.

[0011] This embodiment provides a data format conversion method that automatically finds and extracts real and imaginary data from a target file, ensuring data integrity and freedom from irrelevant interference. Next, it iterates through a first data list, automatically mapping real data to amplitude values ​​and imaginary data to phase values, generating a second data list. Furthermore, it generates the correspondence between frequency, amplitude, and phase values ​​based on the number of data points and constructs standard-compliant CSV format files. These CSV files ensure data format consistency, facilitating subsequent analysis. The data from multiple CSV files are automatically integrated to generate a summary file. This series of automated operations significantly improves data processing efficiency, reduces the risk of human error, simplifies the operation process, and ensures data consistency and accuracy, thus providing an efficient and reliable data processing solution for the microwave measurement field.

[0012] In one implementation, the amplitude value is determined as follows:

[0013] The real part data and the imaginary part data are squared respectively to obtain the corresponding squared value of the real part and the squared value of the imaginary part.

[0014] Summing the squared values ​​of the real part and the squared values ​​of the imaginary part yields the summation result.

[0015] Perform a square root operation on the summation result to obtain the linear amplitude value;

[0016] The amplitude value is obtained by taking the logarithm of the linear amplitude value and amplifying it.

[0017] This embodiment eliminates the influence of sign differences by squaring the real and imaginary parts of the data, ensuring data consistency and accuracy. Next, the amplitude information of the complex signal is extracted by summing the squared values ​​of the real and imaginary parts, simplifying the signal processing. Subsequently, a square root operation is performed to obtain the linear amplitude value, which is then converted into a more comparable decibel (dB) value through logarithmic transformation, further simplifying signal analysis. The entire automated process improves data processing efficiency, avoids potential errors in manual operation, and provides accurate and reliable data support for subsequent signal analysis.

[0018] In one implementation, the phase value is determined as follows:

[0019] Determine the ratio between the real part data and the imaginary part data;

[0020] The arctangent function of the ratio is used to obtain the radians;

[0021] The radian is converted into an angle to obtain the phase value.

[0022] This embodiment automatically extracts the phase information of complex signals by calculating the ratio of the real and imaginary parts of the data, avoiding errors from manual operation. Next, through arctangent calculation, the ratio is converted into radians, accurately extracting the phase angle of the signal. Finally, the radians are converted into angles, making the phase information more intuitive and easier to analyze. The entire automated process greatly simplifies signal processing steps, improves operational efficiency, reduces human error, and ensures data consistency and accuracy. This solution provides a fast and accurate data analysis method for the microwave measurement field, not only improving work efficiency but also ensuring the reliability of results, meeting the technical requirements of "simple operation, high efficiency, and low error tolerance."

[0023] In one implementation, generating the frequency corresponding to each pair of amplitude and phase values ​​in the second data list based on the number of data points in the second data list includes:

[0024] Obtain the number of amplitude or phase values ​​in the second data list to determine the number of data points;

[0025] Read the start frequency and end frequency from the target file, and determine the total bandwidth between the start frequency and the end frequency;

[0026] The data points are segmented, and the frequency difference between adjacent data points is determined based on the total bandwidth and the segmentation result.

[0027] For each pair of amplitude and phase values ​​in the second data list, the frequency corresponding to each pair of amplitude and phase values ​​is determined using the frequency difference.

[0028] This embodiment ensures data processing accuracy and avoids human error by automatically acquiring the number of data points. By automatically reading the start and end frequencies from the target file and calculating the total bandwidth, the frequency range is quickly determined, ensuring the accuracy of the frequency data. The frequency difference is automatically calculated based on the number of data points and the total bandwidth, reducing the complexity of manual calculations and ensuring a uniform distribution of the frequency sequence. By automatically generating the frequency corresponding to each data point using the frequency difference, the operation is simplified, reducing human input errors. The automated execution of these four steps not only improves data processing efficiency but also significantly reduces the possibility of human error, ensuring data consistency and accuracy. The simplified process allows for easy operation by users, improving the processing efficiency of microwave measurements and ensuring the accuracy and consistency of data analysis, providing strong technical support for this field.

[0029] In one implementation, the step of constructing a CSV column format based on the frequency, the amplitude value, and the phase value to obtain a CSV format file matching each target file includes:

[0030] The frequency, amplitude value, and phase value are sequentially mapped to form a CSV column format with three columns of equal length data.

[0031] Write the frequency, amplitude value, and phase value line by line according to the CSV column format to obtain a CSV format file that matches each target file.

[0032] This embodiment constructs a CSV file with three columns of equal length, corresponding to the frequency, amplitude, and phase values ​​sequentially. Then, these data are written to a CSV file row by row. This not only reduces the complexity and time consumption of manual operation but also eliminates input errors or format inconsistencies that may be caused by human factors. The standardized CSV format facilitates subsequent data analysis and visualization using tools such as Excel and MATLAB, improving data processing efficiency and accuracy. This automated solution ensures data consistency, simplifies operation, and enhances data manageability and long-term maintainability. Overall, this approach provides a highly efficient, accurate, and low-error-rate technical solution for the microwave measurement field.

[0033] In one implementation, the step of reading the target data from each CSV file one by one, integrating all the target data, and generating a summary file in CSV format includes:

[0034] Initialize a first list and a second list; wherein the first list is used to cache the filenames of the target files, and the second list is used to cache the target data in the CSV format files;

[0035] Cache steps: Cache the target data to the second list, and cache the filename of the target file corresponding to the CSV format file to the first list;

[0036] Repeat the caching steps until all target data has been read and a summary file in CSV format is generated.

[0037] This embodiment creates two lists during the initialization phase: one for caching the filenames of target files, and the other for storing the target data in CSV format files. Subsequently, through a caching process, the target data of each target file converted to CSV format is stored in the second list, while the filename is stored in the first list, ensuring an accurate correspondence between data and filename. After multiple caching operations, all target data is completely read and summarized. Finally, the data is integrated into a single, structured, and standardized CSV file for easy subsequent analysis. This automated data processing workflow not only improves operational efficiency and reduces human intervention but also ensures data accuracy and consistency, significantly enhancing the efficiency and precision of data processing in the field of microwave measurement.

[0038] Secondly, embodiments of this application provide a data format conversion apparatus, the apparatus comprising:

[0039] The first data list determination unit is used to find target files in the MDF format of microwave measurement data, extract the real part data for representing amplitude and the imaginary part data for representing phase for each target file, and obtain a first data list containing the real part data and the imaginary part data.

[0040] The second data list determination unit is used to traverse the first data list, determine the amplitude value corresponding to the real part data and the phase value corresponding to the imaginary part data, and obtain a second data list containing the amplitude value and the phase value.

[0041] The data format conversion unit is used to generate the frequency corresponding to each pair of amplitude and phase values ​​in the second data list based on the number of data points in the second data list, and to construct a CSV column format based on the frequency, amplitude and phase values ​​to obtain a CSV format file that matches each target file;

[0042] The data aggregation unit is used to read the target data from each CSV file one by one, integrate all the target data, and generate a summary file in CSV format.

[0043] In one embodiment, the data format conversion unit includes:

[0044] The data point count determination module is used to obtain the number of amplitude values ​​or phase values ​​in the second data list and determine the number of data points.

[0045] The total bandwidth determination module is used to read the start frequency and end frequency in the target file and determine the total bandwidth between the start frequency and the end frequency;

[0046] The frequency difference determination module is used to divide the number of data points and determine the frequency difference between adjacent data points based on the total bandwidth and the division result.

[0047] The frequency difference determination module is used to determine the frequency corresponding to each pair of amplitude and phase values ​​in the second data list by using the frequency difference.

[0048] Thirdly, embodiments of this application provide a computer device, including:

[0049] The system includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes these computer instructions to perform the data format conversion method described above.

[0050] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer instructions, which are used to cause a computer to execute the data format conversion method described above. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0052] Figure 1 A flowchart illustrating a data format conversion method provided in an embodiment of this application;

[0053] Figure 2 A flowchart illustrating the method for determining the amplitude value provided in the embodiments of this application;

[0054] Figure 3 A flowchart illustrating the method for determining the phase value provided in the embodiments of this application;

[0055] Figure 4 A flowchart illustrating the frequency determination method provided in the embodiments of this application;

[0056] Figure 5 A flowchart for obtaining a CSV format file provided in this application embodiment;

[0057] Figure 6 A flowchart of step S7 provided in an embodiment of this application;

[0058] Figure 7 A block diagram of a data format conversion device provided in an embodiment of this application;

[0059] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0061] With the continuous development of microwave measurement technology, data processing and analysis have become increasingly important. In the field of microwave measurement, data is often stored in MDF (Measurement Data Format). MDF format has unique advantages, especially in storing large-scale, multi-dimensional measurement data, where it can efficiently preserve a large amount of numerical information. However, the underlying structure of MDF format uses binary encoding and has a complex nested data structure, making direct parsing and processing extremely difficult. To effectively utilize this data for further analysis, this parsing challenge must be overcome.

[0062] Currently, data processing in the microwave measurement field mainly relies on specialized software and manual operation. A common approach is to import MDF format data into specialized software like ADS (Advanced Design System), and then perform data plotting and analysis through a series of complex parameter configurations and visualization operations. After plotting, users typically need to export the generated charts to common formats such as CSV for subsequent processing and analysis. This traditional workflow has several problems. First, it is cumbersome and requires switching between different software programs, which not only increases the complexity of manual operation but also raises the risk of errors, especially in repetitive operations where the possibility of operational errors further increases.

[0063] Furthermore, with the ever-increasing volume of measurement data, traditional manual methods are facing severe efficiency bottlenecks. When processing large-scale data, manual configuration and export are typically time-consuming and labor-intensive, significantly slowing down the overall data processing progress. This creates a significant bottleneck in project advancement, impacting the overall efficiency and accuracy of the work. Against this backdrop, the industry urgently needs a more efficient and accurate solution to automate the processing of MDF format data, reduce tedious manual operations, and improve the efficiency and reliability of data processing.

[0064] While some solutions for data format conversion exist in existing technologies, they are mostly general-purpose solutions and not specifically optimized for MDF format data in the microwave measurement field. Existing methods often fail to effectively address the complexity of the MDF format, particularly in binary structure parsing, batch data processing, and efficient conversion to a universal format, where numerous technical challenges remain. Current solutions generally lack automated programs to directly parse MDF files and convert them into a universal format suitable for subsequent analysis, meaning that data processing still requires significant manual intervention.

[0065] Specific issues include:

[0066] 1. Lack of dedicated MDF parsing methods: Existing technologies are mostly general-purpose methods and have not designed dedicated parsing algorithms for the complex binary structure of MDF format, resulting in low data parsing efficiency and even failure to parse in some cases.

[0067] 2. Operation relies on switching between multiple professional software: The processing flow requires the use of multiple software tools (such as ADS, Matlab, etc.), and frequent switching and parameter configuration make the operation process cumbersome and prone to errors, especially when performing large-scale data processing.

[0068] 3. Inefficiency of manual operation: Significant manual intervention is still required at various stages of data processing, especially in parameter configuration, data validation, and result analysis. This not only increases the time cost of operations but also raises the probability of human error, affecting the accuracy and consistency of the data.

[0069] 4. Difficulties in large-scale data processing: When faced with large amounts of data, existing technologies cannot effectively meet the needs of batch data processing. Manual operation cannot adapt to rapidly changing needs, resulting in extremely low processing efficiency and slowing down project progress.

[0070] 5. Lack of automated parsing and conversion solutions: Currently, there is a lack of automated tools to directly parse MDF format and convert it into common data formats (such as CSV, JSON, etc.). This means that data processing still relies on manual operation and cannot achieve fast and efficient batch data processing.

[0071] In summary, the current microwave measurement field lacks efficient and automated solutions to parse and process complex MDF format data, resulting in cumbersome operations, low efficiency, and a high risk of errors, which is a pressing technical problem that needs to be solved.

[0072] To address the aforementioned technical problems, an embodiment of a data format conversion method is provided according to an embodiment of this application. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0073] This embodiment provides a data format conversion method. Figure 1 A flowchart illustrating a data format conversion method provided in this application embodiment is shown below. Figure 1 As shown, the process includes the following steps:

[0074] Step S1: Locate the target file of microwave measurement data in MDF format, and extract the real part data for representing the amplitude and the imaginary part data for representing the phase for each target file to obtain a first data list containing the real part data and the imaginary part data.

[0075] Specifically, the system recursively searches for target files in MDF format within the specified directory and its subdirectories. This means that regardless of the depth of the directory hierarchy, each file will be checked to ensure that no file matching the criteria is missed. MDF format files are filtered by their file extension or file format identifier. In the file system, these files typically exist with a specific extension (e.g., .mdf). MDF format target files usually contain header information recording metadata such as file creation time, test equipment information, and operator information; this content is irrelevant to the actual measurement data. To avoid this irrelevant information affecting subsequent data extraction, the header information should be skipped, and only the actual measurement data in the file should be read. In microwave measurements, S-parameters (scattering parameters) are used to describe the transmission characteristics of a network, where S21 represents the transmission coefficient from port 1 to port 2, commonly used to measure the gain or attenuation characteristics of devices such as amplifiers and filters. S21 consists of a real part and an imaginary part, representing amplitude and phase, respectively. All real and imaginary data extracted from each target file will be organized into a data list containing complete real (amplitude) and imaginary (phase) information. This list can be used for further analysis or to generate summary reports. Automated scripts or programs written in Python can automatically scan a specified directory and its subdirectories, read MDF files one by one, extract data, and finally generate CSV files. This automated process greatly improves efficiency and reduces errors caused by manual operation, especially when dealing with a large number of files.

[0076] It is important to note that the encoding format of a CSV file is crucial for the correct reading of the data. Different operating systems or applications may use different encoding methods (such as UTF-8, GBK, ASCII, etc.). Therefore, when generating a CSV file, it is essential to ensure that the encoding of the generated file matches that of the target file to avoid garbled characters or data loss due to encoding mismatch. Data in CSV files typically uses delimiters such as commas, tabs, or spaces. When extracting data and writing it to a CSV file, ensure that the delimiter is consistent with the original target file. For example, if the original target file uses tabs to delimit the data, the generated CSV file should also use tabs as the delimiter to ensure that the data format is not affected.

[0077] Step S3: Traverse the first data list, determine the amplitude value corresponding to the real part data and the phase value corresponding to the imaginary part data, and obtain the second data list containing the amplitude value and the phase value.

[0078] Specifically, real and imaginary data are extracted from the MDF format target file to form a first data list. Then, by traversing this first data list, the corresponding amplitude and phase values ​​are calculated for each pair of real and imaginary data using formulas. The amplitude value is expressed in decibels (dB) by calculating the modulus of the complex number, while the phase value is expressed in degrees by calculating the phase angle of the complex number. After calculation, each pair of amplitude and phase values ​​is stored in a second data list for subsequent analysis and processing. This process not only transforms the raw real and imaginary data into more meaningful signal features but also improves data usability and analysis efficiency through a structured data organization method.

[0079] Step S5: Based on the number of data points in the second data list, generate the frequency corresponding to each pair of amplitude and phase values ​​in the second data list, and construct a CSV column format based on the frequency, amplitude, and phase values ​​to obtain a CSV format file that matches each target file.

[0080] Specifically, to generate a CSV file matching each target file, the frequency corresponding to each data point is first calculated based on the number of data points in the second data list, using the start frequency, end frequency, and total number of data points. Then, the calculated frequencies, amplitude values, and phase values ​​are sequentially mapped to form three columns of equal length, creating a standard CSV column format. Finally, data is written line by line according to this format to generate the CSV file, thus saving the processed data in a structured manner, facilitating further data analysis and visualization using tools such as Excel and MATLAB.

[0081] Step S7: Read the target data from each CSV file one by one, integrate all the target data, and generate a summary file in CSV format.

[0082] Specifically, to generate a summary file in CSV format, the target data in each CSV file is first read one by one. During the reading process, data is extracted from each file and stored in a pre-defined data structure for subsequent integration. Then, all extracted data is merged according to certain rules to ensure data consistency and integrity. Finally, the integrated data is written to a new summary file in CSV format. This summary file contains the key data from all target files, facilitating unified management and analysis. This method allows for efficient processing of multiple CSV files and the generation of a comprehensive data view, thus simplifying subsequent data analysis.

[0083] This embodiment provides a data format conversion method that automatically finds and extracts real and imaginary data from a target file, ensuring data integrity and freedom from irrelevant interference. Next, it iterates through a first data list, automatically mapping real data to amplitude values ​​and imaginary data to phase values, generating a second data list. Furthermore, it generates the correspondence between frequency, amplitude, and phase values ​​based on the number of data points and constructs standard-compliant CSV format files. These CSV files ensure data format consistency, facilitating subsequent analysis. The data from multiple CSV files are automatically integrated to generate a summary file. This series of automated operations significantly improves data processing efficiency, reduces the risk of human error, simplifies the operation process, and ensures data consistency and accuracy, thus providing an efficient and reliable data processing solution for the microwave measurement field.

[0084] Figure 2 A flowchart illustrating the method for determining the amplitude value provided in an embodiment of this application, which may include the following steps:

[0085] Step S311: Perform squaring operations on the real part data and the imaginary part data respectively to obtain the corresponding squared values ​​of the real part and the imaginary part.

[0086] Specifically, the real and imaginary parts are two components of a signal. In signal processing, their signs (positive or negative) are usually irrelevant; only their absolute values ​​matter. The purpose of the squaring operation is to eliminate the sign difference, ensuring that the data are non-negative in subsequent calculations. For the real part data `real`, squaring it yields `real`. 2 For the imaginary part data imag, perform a square operation to obtain imag. 2 By squaring, we ensure that all input values ​​for subsequent calculations are non-negative.

[0087] Step S313: Sum the squared values ​​of the real part and the squared values ​​of the imaginary part to obtain the summation result.

[0088] Specifically, the sum of the squared real part and the squared imaginary part obtained through squaring is actually the square of the modulus of the complex number. Specifically: Summation result = Squared real part + Squared imaginary part = real 2 +imag 2 .

[0089] Step S315: Perform a square root operation on the summation result to obtain the linear amplitude value.

[0090] Specifically, by taking the square root of the summation result, we obtain the modulus (amplitude linearity) of the complex number, which represents the amplitude. Specifically: Amplitude linearity = Summation result 1 / 2 =(real 2 +imag2 ) 1 / 2 This value can be used to reflect the strength of a signal, or in some cases, to represent the power of a signal.

[0091] Step S317: Obtain the amplitude value by taking the logarithm of the linear amplitude value and amplifying it.

[0092] Specifically, in the field of microwave measurement, amplitude data is often expressed in decibels (dB). Because the decibel scale is logarithmic, it can compress large amplitude values ​​into a more easily understood and processed numerical range, while improving the comparability of signal strength. Specifically: Amplitude value (dB) = 20 × log 10 (Amplitude linear value) = 20 × log 10 ((real 2 +imag 2 ) 1 / 2 In this way, linear amplitude values ​​are converted into amplitude values ​​on a decibel scale. This is crucial for processing signal strength and evaluating signal quality.

[0093] This embodiment eliminates the influence of sign differences by squaring the real and imaginary parts of the data, ensuring data consistency and accuracy. Next, the amplitude information of the complex signal is extracted by summing the squared values ​​of the real and imaginary parts, simplifying the signal processing. Subsequently, a square root operation is performed to obtain the linear amplitude value, which is then converted into a more comparable decibel (dB) value through logarithmic transformation, further simplifying signal analysis. The entire automated process improves data processing efficiency, avoids potential errors in manual operation, and provides accurate and reliable data support for subsequent signal analysis.

[0094] Figure 3 A flowchart illustrating the method for determining phase values ​​provided in this application embodiment, the process may include the following steps:

[0095] Step S331: Determine the ratio between the real part data and the imaginary part data.

[0096] Specifically, the phase information of complex signals is crucial, reflecting the signal's angle in the complex plane. By calculating the ratio of the real part to the imaginary part, the phase information of the complex signal can be extracted, providing the necessary input for subsequent arctangent calculations. The ratio calculation process avoids errors caused by manual operation. The specific formula is: Ratio = img / real. By calculating this ratio, the phase information of the complex signal can be extracted, providing input for subsequent arctangent calculations.

[0097] Step S333: Compare the values ​​to obtain the arctangent function and get the radians.

[0098] Specifically, the arctangent function converts the ratio into corresponding radians, thereby extracting the signal phase. This process essentially transforms the direction of a complex signal into radians for subsequent processing and comparison; radians = arctan(imag / real).

[0099] Step S335: Convert radians to angles to obtain the phase value.

[0100] Specifically, the radian value is converted into an angle value to obtain the angular representation of the phase: Phase value (angle) = radians × 180 / π.

[0101] It's important to note that calculating the phase of a complex number typically requires calculating the arctangent of the ratio of the imaginary part to the real part. However, directly using the `math.atan` function might result in a division-by-zero error (when the real part is zero). To avoid this, the `math.atan2` function can be used, which handles various input cases, including those with a zero real part, and correctly returns the phase value.

[0102] This embodiment automatically extracts the phase information of complex signals by calculating the ratio of the real and imaginary parts of the data, avoiding errors from manual operation. Next, through arctangent calculation, the ratio is converted into radians, accurately extracting the phase angle of the signal. Finally, the radians are converted into angles, making the phase information more intuitive and easier to analyze. The entire automated process greatly simplifies signal processing steps, improves operational efficiency, reduces human error, and ensures data consistency and accuracy. This solution provides a fast and accurate data analysis method for the microwave measurement field, not only improving work efficiency but also ensuring the reliability of results, meeting the technical requirements of "simple operation, high efficiency, and low error tolerance."

[0103] Figure 4 A flowchart illustrating the frequency determination method provided in this application embodiment, the process may include the following steps:

[0104] Step S511: Obtain the number of amplitude values ​​or phase values ​​in the second data list and determine the number of data points.

[0105] Specifically, the number of amplitude or phase values ​​in the second data list is first obtained to determine the number of data points N. Typically, the number of real and imaginary data points is the same, so one can be chosen as the basis for the data point count. These data points will serve as the foundation for subsequent frequency calculations, determining how the frequency sequence is processed and generated. Accurate acquisition of the data point count is a prerequisite for ensuring the accuracy of frequency calculations, as it directly affects the frequency segmentation and step size calculation. By accurately acquiring the data point count, it is ensured that the frequency difference and frequency sequence generation in subsequent calculation steps are error-free, avoiding errors introduced by manual operation and providing a reliable foundation for subsequent calculations.

[0106] Step S513: Read the start frequency and end frequency from the target file, and determine the total bandwidth between the start frequency and end frequency.

[0107] Specifically, the total bandwidth Δf total It is the stop frequency. freq With the starting frequency freq Difference: Δf total =stop freq -start freq The total bandwidth directly affects the frequency difference and the distribution of the frequency sequence. By determining the frequency range, it can be ensured that the frequency difference calculated subsequently is reasonable and that the frequency does not exceed the expected range.

[0108] Step S515: Divide the data points into segments and determine the frequency difference between adjacent data points based on the total bandwidth and the segmentation results.

[0109] Specifically, the data points are divided into N-1 intervals. The frequency difference Δf is the total bandwidth divided by the division result (i.e., N-1 intervals): Δf = Δf total / (N-1). This frequency difference can be used to generate a linearly spaced frequency sequence, ensuring that the frequency points are uniformly distributed within a given frequency range.

[0110] Step S517: For each pair of amplitude and phase values ​​in the second data list, determine the frequency corresponding to each pair of amplitude and phase values ​​using the frequency difference.

[0111] Specifically, using the frequency difference and the starting frequency, the frequency corresponding to each pair of amplitude and phase values ​​is calculated. i =start freq +i×Δf, where i is the index of the current point (starting from 0), and N is the number of data points. A frequency sequence is generated at linear intervals to ensure a one-to-one correspondence between the frequency, amplitude, and phase values ​​of each data point.

[0112] This embodiment ensures data processing accuracy and avoids human error by automatically acquiring the number of data points. By automatically reading the start and end frequencies from the target file and calculating the total bandwidth, the frequency range is quickly determined, ensuring the accuracy of the frequency data. The frequency difference is automatically calculated based on the number of data points and the total bandwidth, reducing the complexity of manual calculations and ensuring a uniform distribution of the frequency sequence. By automatically generating the frequency corresponding to each data point using the frequency difference, the operation is simplified, reducing human input errors. The automated execution of these four steps not only improves data processing efficiency but also significantly reduces the possibility of human error, ensuring data consistency and accuracy. The simplified process allows for easy operation by users, improving the processing efficiency of microwave measurements and ensuring the accuracy and consistency of data analysis, providing strong technical support for this field.

[0113] Figure 5 The flowchart for obtaining a CSV format file provided in this application embodiment may include the following steps:

[0114] Step S531: Correspond the frequency, amplitude and phase values ​​in sequence to construct a CSV column format of three columns of equal length data.

[0115] Specifically, the frequency, amplitude, and phase values ​​are sequentially mapped to form three equal-length CSV columns. The purpose of this step is to store the parsed data in CSV format for subsequent data analysis and visualization. Ensuring that each column has the same length guarantees data standardization and consistency, thus avoiding processing difficulties caused by data format issues.

[0116] Step S533: Write the frequency, amplitude and phase values ​​row by row according to the CSV column format to obtain a CSV format file that matches each target file.

[0117] Specifically, based on the CSV column format, frequency, amplitude, and phase values ​​are written row by row, ultimately generating a complete CSV file. Each row of data includes a frequency value, an amplitude value, and a phase value. The purpose of this step is to write all the parsed data from the target file into a CSV file in a row-by-row format, making the final output file easy to analyze and visualize using tools such as Excel, MATLAB, etc.

[0118] This embodiment constructs a CSV file with three columns of equal length, corresponding to the frequency, amplitude, and phase values ​​sequentially. Then, these data are written to a CSV file row by row. This not only reduces the complexity and time consumption of manual operation but also eliminates input errors or format inconsistencies that may be caused by human factors. The standardized CSV format facilitates subsequent data analysis and visualization using tools such as Excel and MATLAB, improving data processing efficiency and accuracy. This automated solution ensures data consistency, simplifies operation, and enhances data manageability and long-term maintainability. Overall, this approach provides a highly efficient, accurate, and low-error-rate technical solution for the microwave measurement field.

[0119] Figure 6 The flowchart for step S7 provided in the embodiments of this application may include the following steps:

[0120] Step S71: Initialize the first list and the second list; wherein, the first list is used to cache the filenames of the target files, and the second list is used to cache the target data in the CSV format files.

[0121] Step S73, caching step: cache the target data to the second list, and cache the filename of the target file corresponding to the CSV format file to the first list.

[0122] Step S75: Repeat the caching step until all target data has been read and a summary file in CSV format is generated.

[0123] Specifically, two lists are created to cache the filenames of the target files and the target data in the corresponding CSV files, respectively. Two empty lists are initialized: the first list caches the filenames of the target files, and the second list caches the target data in the CSV files. This process ensures that the target data and filenames match correctly, and that the target data from all converted CSV files is collected into the corresponding cache lists. For each target file being processed, after steps S1 to S5, the target data from the converted CSV file is extracted and stored in the second list, while the filename of the target file is stored in the first list. By iteratively processing all target files, the filename and filtered data of each target file are cached one-to-one in the two lists until all target data has been read. Finally, this cached data is integrated into a summary file.

[0124] This embodiment creates two lists during the initialization phase: one for caching the filenames of target files, and the other for storing the target data in CSV format files. Subsequently, through a caching process, the target data of each target file converted to CSV format is stored in the second list, while the filename is stored in the first list, ensuring an accurate correspondence between data and filename. After multiple caching operations, all target data is completely read and summarized. Finally, the data is integrated into a single, structured, and standardized CSV file for easy subsequent analysis. This automated data processing workflow not only improves operational efficiency and reduces human intervention but also ensures data accuracy and consistency, significantly enhancing the efficiency and precision of data processing in the field of microwave measurement.

[0125] Accordingly, please refer to Figure 7 A block diagram of a data format conversion apparatus provided in an embodiment of this application, the apparatus comprising:

[0126] The first data list determination unit 101 is used to find target files in the MDF format of microwave measurement data, extract the real part data for representing the amplitude and the imaginary part data for representing the phase for each target file, and obtain a first data list containing the real part data and the imaginary part data.

[0127] The second data list determination unit 103 is used to traverse the first data list, determine the amplitude value corresponding to the real part data and the phase value corresponding to the imaginary part data, and obtain a second data list containing amplitude value and phase value.

[0128] The data format conversion unit 105 is used to generate the frequency corresponding to each pair of amplitude and phase values ​​in the second data list based on the number of data points in the second data list, and to construct a CSV column format based on the frequency, amplitude and phase values ​​to obtain a CSV format file that matches each target file.

[0129] The data aggregation unit 107 is used to read the target data from each CSV file one by one, integrate all the target data, and generate a summary file in CSV format.

[0130] In some optional implementations, the second data list determination unit 103 includes:

[0131] Squaring the real and imaginary parts of the data respectively yields the corresponding squared values ​​of the real and imaginary parts.

[0132] Summing the squares of the real and imaginary parts yields the summation result.

[0133] Perform a square root operation on the summation result to obtain the linear amplitude value;

[0134] The amplitude value is obtained by taking the logarithm of the linear amplitude value and amplifying it.

[0135] In some optional implementations, the second data list determination unit 103 includes:

[0136] Determine the ratio between the real part and the imaginary part of the data;

[0137] The arctangent function is calculated from the comparison value to obtain the radians;

[0138] Convert radians to degrees to obtain the phase value.

[0139] In some optional implementations, the data format conversion unit 105 includes:

[0140] Obtain the number of amplitude or phase values ​​in the second data list to determine the number of data points;

[0141] Read the start and end frequencies from the target file and determine the total bandwidth between the start and end frequencies;

[0142] The data points are segmented, and the frequency difference between adjacent data points is determined based on the total bandwidth and the segmentation results.

[0143] For each pair of amplitude and phase values ​​in the second data list, the frequency corresponding to each pair of amplitude and phase values ​​is determined using the frequency difference.

[0144] In some optional implementations, the data format conversion unit 105 includes:

[0145] By sequentially mapping the frequency, amplitude, and phase values, a CSV column format with three columns of equal length is constructed.

[0146] By writing the frequency, amplitude, and phase values ​​row by row according to the CSV column format, a matching CSV file is obtained for each target file.

[0147] In some alternative implementations, the data aggregation unit 107 includes:

[0148] Initialize the first list and the second list; the first list is used to cache the filenames of the target files, and the second list is used to cache the target data in the CSV format files;

[0149] Caching steps: Cache the target data in the second list, and cache the filenames of the target files corresponding to the CSV format files in the first list;

[0150] Repeat the caching process until all target data has been read, generating a summary file in CSV format.

[0151] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0152] In this embodiment, a data format conversion device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.

[0153] Please see Figure 8 , Figure 8 This application provides a schematic diagram of the structure of a computer device, as shown in the embodiment of the present application. Figure 8 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 8 Take a processor 10 as an example.

[0154] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0155] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0156] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0157] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0158] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0159] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the methods shown in the above embodiments are implemented.

[0160] The apparatus, module, or unit described in the above embodiments can be implemented by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0161] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0162] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or units. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0163] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, and devices according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0164] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0165] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0166] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0167] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0168] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

[0169] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method of converting a data format, characterized by, The method comprises: searching for target files in a microwave measurement data MDF format, extracting real part data for representing amplitude and imaginary part data for representing phase for each target file to obtain a first data list containing the real part data and the imaginary part data; traversing the first data list to determine amplitude values corresponding to the real part data and phase values corresponding to the imaginary part data to obtain a second data list containing the amplitude values and the phase values; acquiring the number of amplitude values or phase values in the second data list to determine the number of data points; reading the start frequency and the end frequency in the target file and determining the total frequency width between the start frequency and the end frequency; segmenting the number of data points and determining the frequency difference between adjacent data points according to the total frequency width and the segmentation result; for each pair of amplitude value and phase value in the second data list, determining the frequency corresponding to each pair of amplitude value and phase value by using the frequency difference; constructing a CSV column format according to the frequency, the amplitude value and the phase value to obtain a CSV format file matched with each target file; reading target data in each CSV format file one by one, integrating all the target data to generate a summary file in CSV format.

2. The method of claim 1, wherein, The determination method of the amplitude value is as follows: performing square operation on the real part data and the imaginary part data respectively to obtain corresponding real part square value and imaginary part square value; summing the real part square value and the imaginary part square value to obtain a summation result; performing square root operation on the summation result to obtain an amplitude linear value; obtaining the amplitude value by taking logarithm and amplifying the amplitude linear value.

3. The method of claim 1, wherein, The determination method of the phase value is as follows: determining the ratio between the real part data and the imaginary part data; taking the inverse tangent function of the ratio to obtain a radian; converting the radian into an angle to obtain the phase value.

4. The method of claim 1, wherein, The construction of the CSV column format according to the frequency, the amplitude value and the phase value to obtain a CSV format file matched with each target file comprises: corresponding the frequency, the amplitude value and the phase value in turn to construct a CSV column format of three columns of equal length data; writing the frequency, the amplitude value and the phase value row by row according to the CSV column format to obtain a CSV format file matched with each target file.

5. The method of claim 1, wherein, The reading of target data in each CSV format file one by one and the integration of all the target data to generate a summary file in CSV format comprise: initializing a first list and a second list; wherein the first list is used to cache the file name of the target file, and the second list is used to cache the target data in the CSV format file; a caching step: caching the target data to the second list and caching the file name of the target file corresponding to the CSV format file to the first list; repeating the caching step until all target data are read to generate a summary file in CSV format.

6. A data format conversion apparatus characterized by comprising: The device comprises: The first data list determination unit is configured to search for target files in a microwave measurement data (MDF) format, extract real part data for representing amplitudes and imaginary part data for representing phases for each target file, and obtain a first data list containing the real part data and the imaginary part data. The second data list determination unit is configured to traverse the first data list, determine amplitude values corresponding to the real part data and phase values corresponding to the imaginary part data, and obtain a second data list containing the amplitude values and the phase values. The data format conversion unit is configured to obtain a number of the amplitude values or the phase values in the second data list, determine a data point number, read a start frequency and an end frequency in the target file, determine a total frequency width between the start frequency and the end frequency, split the data point number, determine a frequency difference between adjacent data points according to the total frequency width and the split result, determine a frequency corresponding to each pair of amplitude value and phase value in the second data list by using the frequency difference, and construct a CSV column format according to the frequency, the amplitude value and the phase value to obtain a CSV format file matched with each target file. The data summary unit is configured to read target data in each CSV format file one by one, integrate all the target data, and generate a summary file in a CSV format.

7. The apparatus of claim 6, wherein, The data format conversion unit comprises: A data point number determination module configured to obtain a number of the amplitude values or the phase values in the second data list, and determine a data point number. A total frequency width determination module configured to read a start frequency and an end frequency in the target file, and determine a total frequency width between the start frequency and the end frequency. A frequency difference determination module configured to split the data point number, and determine a frequency difference between adjacent data points according to the total frequency width and a split result. A frequency determination module configured to determine a frequency corresponding to each pair of amplitude value and phase value in the second data list by using the frequency difference.

8. A computer device, comprising: The data format conversion unit comprises: A memory and a processor, which are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the data format conversion method in any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a computer to perform the data format conversion method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multi-format waveform data file batch processing method

    CN105260422A

  • Cesium optical-pumping magnetometer frequency measurement method and system based on all-phase FFT

    CN110297199A