Storage space allocation method, device, electronic device and storage medium
By adjusting the storage space allocation method of the TCSPC circuit, determining the number sequence of groups to be merged and the target difference range, the problems of idleness and waste of storage units caused by the centralized distribution of effective signals are solved, and the time difference distribution accuracy and storage efficiency are achieved.
Patent Information
- Application Number
- CN202210317698.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-03-29
AI Technical Summary
When storing the time difference histogram, the effective signal is concentratedly distributed near a single or several characteristic time difference values, resulting in idleness and waste of storage units. At the same time, adjusting the reference difference value interval to the target difference interval may cause signal loss.
By adjusting the storage space allocation method, the number sequence of groups of the difference interval to be merged and the target difference interval is determined, the storage space of each difference interval to be merged is increased, and the time difference range that can be observed in the reference difference interval is retained, the memory unit idleness and signal loss are reduced.
On the premise of retaining the accuracy of the time difference distribution and observable range, the idleness and waste of memory cells are reduced, signal loss is avoided, and the accuracy of the time difference distribution is improved.
Smart Images

Figure CN114691043B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a storage space allocation method, device, electronic device and storage medium. Background Art
[0002] Time-correlated single photon counting (TCSPC) is a technique used to precisely measure the time difference between two physical events. It is widely used in fields requiring extremely high accuracy in time difference measurement, such as lidar ranging. In practical applications, repeated measurements are performed while keeping all experimental parameters identical. Due to errors and randomness, the time difference between two physical phenomena measured using TCSPC will be distributed around one or several characteristic values in the time domain. When a certain number of repeated measurements are performed, a distribution histogram of the measured time difference in the time domain can be obtained. This distribution histogram encompasses many important data points about the measured physical phenomenon and serves as an important basis for data post-processing.
[0003] When TCSPC is implemented as a circuit, the time difference histogram is stored in the corresponding memory cells. The physical size of the memory determines its storage capacity and the size of the stored time difference histogram data. A large amount of time difference histogram data can improve the time difference recording accuracy of the TCSPC circuit, achieve a wider data dynamic range, and extend the maximum time difference recording time. Therefore, the memory capacity plays a decisive role in the performance of the TCSPC circuit.
[0004] Existing TCSPC circuits store time difference histograms by recording the time differences of detected events according to preset parameters during TCSPC operation. Because the time differences of detected events can vary widely, the parameters of the distribution histogram must also cover as wide a time domain as possible. However, in actual storage, the time differences of detected events within a single TCSPC operation cycle are often concentrated around a single or a few characteristic time difference values. This results in idle and wasted storage cells beyond these single or a few characteristic time difference values. Summary of the Invention
[0005] Embodiments of the present application provide a storage space allocation method, apparatus, electronic device, and storage medium. These methods can reduce the idleness and waste of storage units caused by the concentration of valid signals in a single or a few characteristic time-difference values, while preserving a reference difference interval, i.e., the observable time-difference range. Furthermore, they can avoid signal loss caused by adjusting the reference difference interval to a target difference interval, thereby improving the accuracy of the time-difference distribution.
[0006] An embodiment of the present application provides a method for allocating storage space, including:
[0007] Obtaining a set of time difference data to be processed and a preset group number sequence; the storage space corresponding to each group in the preset group number sequence is equal;
[0008] According to the time difference data set to be processed, determining the difference interval set to be merged and the target difference interval from the reference difference interval;
[0009] Determine, from the preset group number sequence, the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval;
[0010] Adjust the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain the merged group number sequence corresponding to each difference interval to be merged and the target group number sequence corresponding to the target difference interval;
[0011] Among them, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is greater than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is greater than the number of groups in the group number sequence corresponding to the target difference interval; the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is less than the number of groups in the preset group number sequence.
[0012] Furthermore, according to the time difference data set to be processed, determining the difference interval set to be merged and the target difference interval from the reference difference interval includes:
[0013] According to the time difference data set to be processed, determining a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval;
[0014] Among them, the number of time difference data to be processed corresponding to the first difference interval to be merged is less than the preset number threshold, the number of time difference data to be processed corresponding to the second difference interval to be merged is less than the preset number threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to the preset number threshold.
[0015] Furthermore, the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval are adjusted to obtain the merged group number sequence corresponding to each difference interval to be merged and the target group number sequence corresponding to the target difference interval, including:
[0016] The first two groups in the preset group number sequence are used as the first merged group number sequence corresponding to the first difference interval to be merged;
[0017] The two groups at the end of the preset group number sequence are used as the second merged group number sequence corresponding to the second difference interval to be merged;
[0018] The groups other than the first two groups and the last two groups in the preset group number sequence are used as the target group number sequence corresponding to the target difference interval.
[0019] Furthermore, after determining the first difference interval to be merged, the target difference interval, and the second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed, the method further includes:
[0020] Determining a first difference sub-interval to be merged and a second difference sub-interval to be merged from the first difference interval to be merged; the lower limit value of the second difference sub-interval to be merged is greater than or equal to the upper limit value of the first difference sub-interval to be merged;
[0021] Determine, from the preset group number sequence, a group number sequence corresponding to the first difference subinterval to be merged and a group number sequence corresponding to the second difference subinterval to be merged;
[0022] Adjusting the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged to obtain a first merged group number subsequence corresponding to the first difference subinterval to be merged and a second merged group number subsequence corresponding to the second difference subinterval to be merged;
[0023] Among them, the storage space corresponding to the first merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the first difference subinterval to be merged; the storage space corresponding to the second merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the second difference subinterval to be merged.
[0024] Furthermore, after obtaining the first merging group number subsequence corresponding to the first difference subinterval to be merged and the second merging group number subsequence corresponding to the second difference subinterval to be merged, the method further includes:
[0025] Performing storage processing on the time difference data set to be processed, and determining the stored space corresponding to the second difference subinterval to be merged;
[0026] If the ratio of the stored space corresponding to the second difference sub-interval to be merged to the storage space corresponding to the second difference sub-interval to be merged is greater than a preset ratio threshold, the target difference interval is updated to obtain an updated target difference interval; the updated target difference interval includes the second difference sub-interval to be merged and the target difference interval.
[0027] Accordingly, an embodiment of the present application provides a storage space allocation device, comprising:
[0028] An acquisition module is used to acquire a set of time difference data to be processed and a preset group number sequence; the storage space corresponding to each group in the preset group number sequence is equal;
[0029] A first determining module is configured to determine a set of difference intervals to be merged and a target difference interval from the reference difference intervals according to the set of time difference data to be processed;
[0030] A second determining module is configured to determine, from a preset group number sequence, a group number sequence corresponding to each difference interval to be merged and a group number sequence corresponding to a target difference interval;
[0031] A first adjustment module is used to adjust the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval;
[0032] Among them, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is greater than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is greater than the number of groups in the group number sequence corresponding to the target difference interval; the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is less than the number of groups in the preset group number sequence.
[0033] Furthermore, a first determining module is configured to determine a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed;
[0034] Among them, the number of time difference data to be processed corresponding to the first difference interval to be merged is less than the preset number threshold, the number of time difference data to be processed corresponding to the second difference interval to be merged is less than the preset number threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to the preset number threshold.
[0035] Furthermore, the first adjustment module includes:
[0036] A first merging submodule, configured to use the first two groups in the preset group number sequence as a first merging group number sequence corresponding to a first difference interval to be merged;
[0037] A second merging submodule is configured to use the last two groups in the preset group number sequence as a second merging group number sequence corresponding to the second difference interval to be merged;
[0038] The first determining submodule is configured to use the groups other than the first two groups and the last two groups in the preset group number sequence as the target group number sequence corresponding to the target difference interval.
[0039] Furthermore, the device further comprises:
[0040] The second adjustment module includes:
[0041] a second determining submodule configured to, after determining a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval based on the set of time difference data to be processed, determine a first difference subinterval to be merged and a second difference subinterval to be merged from the first difference interval to be merged; wherein a lower limit value of the second difference subinterval to be merged is greater than or equal to an upper limit value of the first difference subinterval to be merged;
[0042] A third determining submodule is configured to determine, from a preset group number sequence, a group number sequence corresponding to the first difference subinterval to be merged and a group number sequence corresponding to the second difference subinterval to be merged;
[0043] an adjusting submodule, configured to adjust the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged, to obtain a first merged group number subsequence corresponding to the first difference subinterval to be merged and a second merged group number subsequence corresponding to the second difference subinterval to be merged;
[0044] Among them, the storage space corresponding to the first merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the first difference subinterval to be merged; the storage space corresponding to the second merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the second difference subinterval to be merged.
[0045] Furthermore, the second adjustment module further includes:
[0046] a storage submodule configured to, after obtaining a first merging group number subsequence corresponding to the first difference subinterval to be merged and a second merging group number subsequence corresponding to the second difference subinterval to be merged, perform storage processing on the time difference data set to be processed and determine a stored space corresponding to the second difference subinterval to be merged;
[0047] An updating submodule is configured to update the target difference interval if the ratio of the stored space corresponding to the second difference subinterval to be merged to the storage space corresponding to the second difference subinterval to be merged is greater than a preset ratio threshold, thereby obtaining an updated target difference interval; the updated target difference interval includes the second difference subinterval to be merged and the target difference interval.
[0048] Accordingly, an embodiment of the present application also provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the above-mentioned storage space allocation method.
[0049] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the above-mentioned storage space allocation method.
[0050] The embodiments of the present application have the following beneficial effects:
[0051] The present application discloses a method, device, electronic device, and storage medium for allocating storage space. The method includes obtaining a set of time difference data to be processed and a preset group number sequence, wherein each group in the preset group number sequence has an equal storage space. Based on the set of time difference data to be processed, a set of difference intervals to be merged and a target difference interval are determined from a reference difference interval. Then, from the preset group number sequence, a group number sequence corresponding to each difference interval to be merged and a group number sequence corresponding to the target difference interval are determined. The group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval are adjusted to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval. The storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is greater than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is greater than the number of groups in the group number sequence corresponding to the target difference interval; and the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is less than the number of groups in the preset group number sequence. Based on the embodiments of the present application, while retaining the reference difference interval, i.e., the observable time difference range, the idle and wasted storage units caused by the concentration of valid signals in a single or a few characteristic time difference values can be reduced. Furthermore, the problem of signal loss caused by adjusting the reference difference interval to the target difference interval can be avoided, thereby improving the accuracy of the time difference distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0053] Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application;
[0054] Figure 2 It is a schematic diagram of a static storage method of a TCSPC circuit;
[0055] Figure 3It is a schematic diagram of another static storage method of TCSPC circuit;
[0056] Figure 4 This is a flowchart of a storage space allocation method provided in an embodiment of the present application;
[0057] Figure 5 is a schematic diagram of a storage space allocation method provided in an embodiment of the present application;
[0058] Figure 6 It is a structural diagram of a storage space allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] To make the objectives, technical solutions, and advantages of this application more clear, the following embodiments of this application will be further described in detail with reference to the accompanying drawings. Obviously, the described embodiment is only one embodiment of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0060] The “embodiment” referred to herein refers to a specific feature, structure or characteristic that may be included in at least one implementation of the present application. In the description of the embodiments of the present application, it should be understood that the terms “first” and “second” are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as “first” or “second” may explicitly or implicitly include one or more of the features. Moreover, the terms “first”, “second”, etc. are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described here. In addition, the terms “including”, “having” and “for” and any variations thereof are intended to cover non-exclusive inclusions.
[0061] See also Figure 1, which shows a schematic diagram of an application environment provided by an embodiment of the present application, including a processor, which can be loaded with a time single photon counting circuit. The logic processing circuit in the time single photon counting circuit can obtain a set of time difference data to be processed and a preset group number sequence, and the storage space corresponding to each group in the preset group number sequence is equal. According to the set of time difference data to be processed, the set of difference intervals to be merged and the target difference interval are determined from the reference difference interval. Then, from the preset group number sequence, the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval are determined, and the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval are adjusted to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval. Among them, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is greater than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is greater than the number of groups in the group number sequence corresponding to the target difference interval; the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is less than the number of groups in the preset group number sequence.
[0062] The embodiments of the present application can reduce the idleness and waste of storage units caused by the concentration of valid signals in a single or a few characteristic time difference values, while retaining the reference difference interval, i.e., the observable time difference range. Furthermore, the signal loss problem caused by adjusting the reference difference interval to the target difference interval can be avoided, thereby improving the accuracy of the time difference distribution.
[0063] Figure 2 This is a schematic diagram of a static storage method for a TCSPC circuit. The storage space of a fixed size of M×K bits in the static memory is divided into M groups to obtain a preset group number sequence. Each group uses K bits of storage space to obtain the storage space corresponding to each group. The preset group number sequence and the storage space corresponding to each group in the preset group number sequence constitute a time difference distribution histogram. Among them, the storage space of each group needs to accommodate the maximum number of "events" that can be foreseen in a single group. Under the premise that the total storage space is fixed, the number of groups M depends on the value of the storage space K of each group. In order to meet the test accuracy requirements, the length of the time difference interval covered by each group can be pre-set to dt, and the reference difference interval of the TCSPC circuit can be calculated, that is, the observable time difference range is 0~t max Among them, t max =M×dt,t max Indicates the maximum time difference value. You can also pre-set the observable time difference range to 0~t max It can be deduced that the length of the time difference interval covered by each group is dt=t max / M.
[0064] In the data storage process of TCSPC circuit, due to many factors such as signal noise and physical instability, there will be a certain amount of background noise in the time difference interval corresponding to each group in the preset group sequence. In specific application scenarios, the signal strength of the background noise, that is, the number of "events" that appear in a unit time difference interval, is fixed, such as Figure 2 Each group uses Q bits of storage space to store background noise, that is, the intensity of the background noise is less than or equal to Q. When the TCSPC circuit detects a real signal, its signal strength is often much greater than the signal strength of the background noise. At this time, in a relatively narrow time difference interval, such as Figure 2 In the example, the signal strength begins to increase significantly at time difference t1 and continues to increase until it drops back to the background noise level at time difference t2. Time differences t1 to t2 correspond to groups N+1 to N+P in the time difference distribution histogram. If the time difference interval covered by each group is dt, we can infer that t2 = t1 + P × dt.
[0065] Based on the static storage method described above in the TCSPC circuit, the time differences of detected "events" can be stored in a time difference distribution histogram. However, in actual storage, the situation of P < < M often occurs, resulting in more storage space corresponding to the MP group in the memory being used to store background noise, while less storage space corresponding to the P group is used to store the actual signal. In other words, within a single TCSPC operation cycle, the time differences of the detected "events" are often concentrated around a single or a few characteristic time difference values. This results in the unused and wasted storage cells outside of these single or a few characteristic time difference values.
[0066] To solve Figure 2 Example of static storage method problem of TCSPC circuit, Figure 3 This is a schematic diagram of another static storage method of the TCSPC circuit. In the initial stage of a single TCSPC operation cycle, the TCSPC circuit still follows Figure 2 Then, the time difference distribution histogram is readjusted by determining the single or several characteristic time difference values where the effective signals are concentrated according to the time difference data set to be processed. For example, when it is determined that the effective signals are concentrated in the target difference interval t1~t2, Figure 2 The reference difference value interval 0~t in the time difference distribution histogram of the example max Adjust to Figure 3 The reference difference interval in the example time difference distribution histogram is t1-t2. This will cause signals outside the target difference interval t1-t2 to be completely ignored. In actual operation, after determining the single or several characteristic time difference values where valid signals are concentrated, the valid signals may shift, or even some valid signals may appear in the new time difference interval t1'-t2'. This will cause the adjusted time difference distribution histogram to not accurately reflect the actual time difference distribution.
[0067] When the valid signal deviates or appears in the new time difference interval t1'-t2', the TCSPC circuit can use this as a warning information and choose to terminate the current operation cycle and redefine the target difference interval, or transmit the warning information to upstream and downstream circuits and provide a prediction in the next operation cycle.
[0068] The following describes a specific embodiment of a storage space allocation method of the present application. Figure 4 This is a flow chart of a storage space allocation method provided in an embodiment of the present application. Figure 5 This is a schematic diagram of a storage space allocation method provided in an embodiment of the present application. This specification provides method operation steps as shown in the embodiments or flowcharts, but more or fewer operation steps may be included based on routine or non-creative work. The order of steps listed in the embodiments is only one of many execution sequences and does not represent the only execution sequence. In actual execution, the method can be executed in the order shown in the embodiments or figures or in parallel (for example, in a parallel processor or multi-threaded processing environment).
[0069] Specific examples Figure 2 、 4 As shown in 5, the storage space allocation method may include:
[0070] S401: Obtain a time difference data set to be processed and a preset group number sequence; the storage space corresponding to each group in the preset group number sequence is equal.
[0071] In the embodiment of the present application, the logic processing circuit in the TCSPC circuit can obtain a set of time difference data to be processed and a preset group number sequence M. Each group in the preset group number sequence M can use K bits of storage space.
[0072] S403: According to the time difference data set to be processed, determine a difference interval set to be merged and a target difference interval from the reference difference interval.
[0073] In an embodiment of the present application, when a single TCSPC operation cycle is performed, the logic processing circuit can, based on the distribution of the set of time difference data to be processed in the time difference distribution histogram, take the difference interval in the reference difference interval 0~tmax where the number of time difference data to be processed is less than the preset number threshold as the difference interval to be merged, and take the difference interval in the reference difference interval where the number of time difference data to be processed is greater than the preset number threshold as the target difference interval.
[0074] In an optional embodiment, a first difference interval to be merged, a target difference interval, and a second difference interval to be merged can be determined from a reference difference interval 0 to tmax based on the set of time difference data to be processed. The number of time difference data to be processed corresponding to the first difference interval to be merged is less than a preset threshold, the number of time difference data to be processed corresponding to the second difference interval to be merged is less than a preset threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to a preset threshold. The preset threshold can be preset based on the signal strength of background noise determined during multiple calculations.
[0075] based on Figure 2 For the target difference interval corresponding to the valid signal in the example, the lower limit of the first difference interval to be merged can be 0, and the upper limit of the first difference interval to be merged can be equal to the lower limit of the target difference interval, such as t1. The upper limit of the target difference interval can be equal to the lower limit of the second difference interval to be merged, such as t2, and the upper limit of the second difference interval to be merged can be tmax.
[0076] In another optional embodiment, a difference interval to be merged and a target difference interval can be determined from a reference difference interval 0 to tmax based on the set of time difference data to be processed. The number of time difference data to be processed corresponding to the merged difference interval is less than a preset threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to a preset threshold. The preset threshold can be preset based on the signal strength of background noise determined during multiple calculations.
[0077] based on Figure 2 In the target difference interval corresponding to the valid signal in the example, the lower limit of the difference interval to be merged can be 0, and the upper limit of the difference interval to be merged can be equal to the lower limit of the target difference interval, such as t1. The lower limit of the target difference interval can be t max That is, one or more difference intervals to be merged may be determined from the reference difference intervals according to the specific concentrated distribution of the real signal, and the specific number thereof is not specifically limited in the embodiment of the present application.
[0078] In the embodiment of the present application, after determining the first difference interval to be merged, the target difference interval, and the second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed, the logic processing circuit can determine the first difference sub-interval to be merged and the second difference sub-interval to be merged from the first difference interval to be merged. The lower limit value of the second difference sub-interval to be merged is greater than or equal to the upper limit value of the first difference sub-interval to be merged. Based on Figure 2In the target difference interval corresponding to the valid signal in the example, the lower limit value of the first difference sub-interval to be merged can be 0, the upper limit value of the first difference sub-interval to be merged can be equal to the lower limit value of the second difference sub-interval to be merged, such as t1', and the upper limit value of the second difference sub-interval to be merged can be t1, where t1' is less than t1.
[0079] S405: Determine, from the preset group number sequences, the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval.
[0080] In the embodiment of the present application, the logic processing circuit can determine the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval from the preset group number sequence M. For example, Figure 2 In the example, the preset group number sequence is determined to include a group number sequence 0 to N corresponding to the first difference interval to be merged, and a group number sequence N+P+1 to M corresponding to the second difference interval to be merged.
[0081] In an embodiment of the present application, after determining the first difference sub-interval to be merged and the second difference sub-interval to be merged from the first difference interval to be merged, the group number sequence corresponding to the first difference sub-interval to be merged and the group number sequence corresponding to the second difference sub-interval to be merged can be determined from the preset group number sequence.
[0082] S407: Adjust the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval. The storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is larger than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is larger than the number of groups in the group number sequence corresponding to the target difference interval; and the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is smaller than the number of groups in the preset group number sequence.
[0083] In the embodiment of the present application, during the adjustment of the preset group number sequence, Figure 3 The difference between the examples is that the present embodiment still observes Figure 2 The reference difference value interval 0~t in the time difference distribution histogram of the example max However, the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval will be adjusted to increase the storage space corresponding to the group number sequence corresponding to each storage interval to be merged and increase the number of groups in the group number sequence corresponding to the target difference interval.
[0084] In an optional embodiment, the first two groups in the preset group number sequence can be used as the first merged group number sequence corresponding to the first difference interval to be merged, the last two groups in the preset group number sequence can be used as the second merged group number sequence corresponding to the second difference interval to be merged, and the groups other than the first two groups and the last two groups in the preset group number sequence can be used as the target group number sequence corresponding to the target difference interval. Since the first two groups in the preset group number sequence are used as the first merged group number sequence corresponding to the first difference interval to be merged, and the last two groups in the preset group number sequence are used as the second merged group number sequence corresponding to the second difference interval to be merged, the sum M-2 of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is less than the number of groups in the preset group number sequence M.
[0085] Optionally, Figure 5 The first bin 1 and the second bin M-2 in the _ ... Figure 5 The storage space corresponding to the first merged group sequence bin 1 is greater than Figure 2 The storage space corresponding to bin 1 in the second merged group sequence bin M-2 is greater than Figure 2 The storage space corresponding to bin M in Figure 5 The number of groups corresponding to the target group sequence bin2~binM-3 is greater than Figure 2 The number of groups corresponding to the target group number sequence bin2~binN+P.
[0086] In an embodiment of the present application, after determining the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged from a preset group number sequence, the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged can be adjusted to obtain a first merged group number subsequence corresponding to the first difference subinterval to be merged and a second merged group number subsequence corresponding to the second difference subinterval to be merged. The storage space corresponding to the first merged group number subsequence can be larger than the storage space corresponding to the group number sequence corresponding to the first difference subinterval to be merged, and the storage space corresponding to the second merged group number subsequence can be larger than the storage space corresponding to the group number sequence corresponding to the second difference subinterval to be merged. Then, the time difference data set to be processed can be stored, and the stored space corresponding to the second difference subinterval to be merged can be determined. If the ratio of the stored space corresponding to the second difference subinterval to be merged to the stored space corresponding to the second difference subinterval to be merged is greater than a preset ratio threshold, the target difference interval can be updated to obtain an updated target difference interval. The updated target difference interval includes the second difference subinterval to be merged and the target difference interval. That is, in a new computation cycle, the second difference subinterval to be merged and the target difference interval can be merged to form a new target difference interval. This reduces the risk of misdetermination of the target difference interval due to the limited known data.
[0087] The storage space allocation method provided in the embodiments of the present application can reduce the idleness and waste of storage units caused by the concentration of valid signals in a single or a few characteristic time-difference values, while preserving the reference difference interval, i.e., the observable time-difference range. Furthermore, it avoids signal loss caused by adjusting the reference difference interval to the target difference interval, thereby improving the accuracy of the time-difference distribution.
[0088] The embodiment of the present application also provides a storage space allocation device, Figure 6 This is a schematic diagram of the structure of a storage space allocation device provided in an embodiment of the present application. Figure 6 As shown, the device may include:
[0089] The acquisition module 601 is used to obtain a set of time difference data to be processed and a preset group number sequence; the storage space corresponding to each group in the preset group number sequence is equal;
[0090] The first determining module 603 is configured to determine a set of difference intervals to be merged and a target difference interval from the reference difference intervals according to the set of time difference data to be processed;
[0091] The second determining module 605 is used to determine the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval from the preset group number sequence;
[0092] The first adjustment module 607 is used to adjust the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval; wherein, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is larger than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is larger than the number of groups in the group number sequence corresponding to the target difference interval; and the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is smaller than the number of groups in the preset group number sequence.
[0093] In the embodiment of the present application, the first determining module is configured to determine a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed;
[0094] Among them, the number of time difference data to be processed corresponding to the first difference interval to be merged is less than the preset number threshold, the number of time difference data to be processed corresponding to the second difference interval to be merged is less than the preset number threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to the preset number threshold.
[0095] In the embodiment of the present application, the first adjustment module includes:
[0096] A first merging submodule, configured to use the first two groups in the preset group number sequence as a first merging group number sequence corresponding to a first difference interval to be merged;
[0097] A second merging submodule is configured to use the last two groups in the preset group number sequence as a second merging group number sequence corresponding to the second difference interval to be merged;
[0098] The first determining submodule is configured to use the groups other than the first two groups and the last two groups in the preset group number sequence as the target group number sequence corresponding to the target difference interval.
[0099] In the embodiment of the present application, the device further includes:
[0100] The second adjustment module includes:
[0101] a second determining submodule configured to, after determining a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval based on the set of time difference data to be processed, determine a first difference subinterval to be merged and a second difference subinterval to be merged from the first difference interval to be merged; wherein a lower limit value of the second difference subinterval to be merged is greater than or equal to an upper limit value of the first difference subinterval to be merged;
[0102] A third determining submodule is configured to determine, from a preset group number sequence, a group number sequence corresponding to the first difference subinterval to be merged and a group number sequence corresponding to the second difference subinterval to be merged;
[0103] an adjusting submodule, configured to adjust the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged, to obtain a first merged group number subsequence corresponding to the first difference subinterval to be merged and a second merged group number subsequence corresponding to the second difference subinterval to be merged;
[0104] Among them, the storage space corresponding to the first merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the first difference subinterval to be merged; the storage space corresponding to the second merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the second difference subinterval to be merged.
[0105] In the embodiment of the present application, the second adjustment module further includes:
[0106] a storage submodule configured to, after obtaining a first merging group number subsequence corresponding to the first difference subinterval to be merged and a second merging group number subsequence corresponding to the second difference subinterval to be merged, perform storage processing on the time difference data set to be processed and determine a stored space corresponding to the second difference subinterval to be merged;
[0107] An updating submodule is configured to update the target difference interval if the ratio of the stored space corresponding to the second difference subinterval to be merged to the storage space corresponding to the second difference subinterval to be merged is greater than a preset ratio threshold, thereby obtaining an updated target difference interval; the updated target difference interval includes the second difference subinterval to be merged and the target difference interval.
[0108] The device and method embodiments in the embodiments of this application are based on the same application concept.
[0109] The storage space allocation device provided in the embodiments of the present application can reduce the idleness and waste of storage units caused by the concentration of valid signals in a single or a few characteristic time difference values, while preserving the reference difference interval, i.e., the observable time difference range. Furthermore, it avoids signal loss caused by adjusting the reference difference interval to the target difference interval, thereby improving the accuracy of the time difference distribution.
[0110] An embodiment of the present application also provides an electronic device, which can be set in a server to store at least one instruction, at least one program, code set or instruction set related to a storage space allocation method for implementing a method embodiment. The at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the memory to implement the above-mentioned storage space allocation method.
[0111] An embodiment of the present application also provides a storage medium, which can be set in a server to store at least one instruction, at least one program, code set or instruction set related to a storage space allocation method in an implementation method embodiment. The at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the above-mentioned storage space allocation method.
[0112] Optionally, in this embodiment, the storage medium may be located in at least one of a plurality of network servers in the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a read-only memory (ROM), a mobile hard drive, a magnetic disk, or an optical disk.
[0113] As can be seen from the embodiments of the storage space allocation method, device, electronic device or storage medium provided by the present application, the allocation method in the present application includes obtaining a set of time difference data to be processed and a preset group number sequence, wherein the storage space corresponding to each group in the preset group number sequence is equal, and determining a set of difference intervals to be merged and a target difference interval from a reference difference interval based on the set of time difference data to be processed. Then, from the preset group number sequence, the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval are determined, and the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval are adjusted to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval. In this case, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is greater than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is greater than the number of groups in the group number sequence corresponding to the target difference interval; and the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is less than the number of groups in the preset group number sequence. Based on the embodiments of the present application, while retaining the reference difference interval, i.e., the observable time difference range, the idleness and waste of storage units caused by the concentration of valid signals in a single or a few characteristic time difference values can be reduced. Furthermore, the signal loss caused by adjusting the reference difference interval to the target difference interval can be avoided, thereby improving the accuracy of the time difference distribution.
[0114] In the present invention, unless otherwise expressly specified or limited, the terms "connected" and "connection" should be understood in a broad sense. For example, they can refer to fixed connection, detachable connection, or integration; mechanical connection, electrical connection; direct connection, indirect connection through an intermediate medium; internal connection between two components, or interaction between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.
[0115] It should be noted that the order of the embodiments of the present application described above is for descriptive purposes only and does not represent the superiority or inferiority of the embodiments. The above description describes specific embodiments, and other embodiments are also within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in the order of different embodiments and can achieve the expected results. In addition, the processes depicted in the accompanying drawings do not necessarily require a specific order or a connection order to achieve the desired results. In some embodiments, multi-tasking parallel processing is also possible or may be advantageous.
[0116] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device embodiments are similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the partial description of the method embodiments.
[0117] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for allocating storage space, characterized in that: include: Obtaining a set of time difference data to be processed and a preset group number sequence; The storage space corresponding to each group in the preset group number sequence is equal; The preset group number sequence is a sequence obtained by dividing the storage space of the static memory into M groups. The preset group number sequence and the storage space corresponding to each group in the preset group number sequence constitute a time difference distribution histogram. The length of the time difference interval corresponding to each group is the maximum time difference value t of the reference difference value interval. max The reference difference interval is the observable time difference range 0~t max The time difference data to be processed in the set of time difference data to be processed represents the time difference of the detected events recorded when the TCSPC circuit is running; Determining a set of difference intervals to be merged and a target difference interval from the reference difference intervals according to the set of time difference data to be processed; The set of difference intervals to be merged is a difference interval in which the number of time difference data to be processed corresponding to the reference difference interval is less than a preset number threshold, and the target difference interval is a difference interval in which the number of time difference data to be processed corresponding to the reference difference interval is greater than the preset number threshold; Determine, from the preset group number sequences, a group number sequence corresponding to each difference interval to be merged and a group number sequence corresponding to the target difference interval; Adjusting the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval; Among them, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is larger than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is larger than the number of groups in the group number sequence corresponding to the target difference interval; the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is smaller than the number of groups in the preset group number sequence.
2. The method according to claim 1, characterized in that The step of determining a set of difference intervals to be merged and a target difference interval from the reference difference intervals according to the set of time difference data to be processed includes: Determining a first difference interval to be merged, the target difference interval, and a second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed; Among them, the number of time difference data to be processed corresponding to the first difference interval to be merged is less than a preset number threshold, the number of time difference data to be processed corresponding to the second difference interval to be merged is less than the preset number threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to the preset number threshold.
3. The method according to claim 2, characterized in that The adjusting the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain the merged group number sequence corresponding to each difference interval to be merged and the target group number sequence corresponding to the target difference interval includes: Using the first two groups in the preset group number sequence as a first merged group number sequence corresponding to the first difference interval to be merged; The last two groups in the preset group number sequence are used as the second merged group number sequence corresponding to the second difference interval to be merged; The groups other than the two groups at the head and the two groups at the tail in the preset group number sequence are used as the target group number sequence corresponding to the target difference interval.
4. The method according to claim 2, characterized in that After determining the first difference interval to be merged, the target difference interval, and the second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed, the method further includes: Determining a first difference sub-interval to be merged and a second difference sub-interval to be merged from the first difference interval to be merged; a lower limit value of the second difference sub-interval to be merged is greater than or equal to an upper limit value of the first difference sub-interval to be merged; Determine, from the preset group number sequence, a group number sequence corresponding to the first difference subinterval to be merged and a group number sequence corresponding to the second difference subinterval to be merged; Adjusting the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged to obtain a first merged group number subsequence corresponding to the first difference subinterval to be merged and a second merged group number subsequence corresponding to the second difference subinterval to be merged; Among them, the storage space corresponding to the first merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the first difference subinterval to be merged; the storage space corresponding to the second merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the second difference subinterval to be merged.
5. The method according to claim 4, characterized in that After obtaining the first merging group number subsequence corresponding to the first difference subinterval to be merged and the second merging group number subsequence corresponding to the second difference subinterval to be merged, the method further includes: Performing storage processing on the to-be-processed time difference data set to determine a stored space corresponding to the second to-be-merged difference subinterval; If the ratio of the stored space corresponding to the second difference sub-interval to be merged to the storage space corresponding to the second difference sub-interval to be merged is greater than a preset ratio threshold, the target difference interval is updated to obtain an updated target difference interval; the updated target difference interval includes the second difference sub-interval to be merged and the target difference interval.
6. A storage space allocation device, characterized in that: include: An acquisition module is used to acquire a set of time difference data to be processed and a preset group number sequence; The storage space corresponding to each group in the preset group number sequence is equal; The preset group number sequence is a sequence obtained by dividing the storage space of the static memory into M groups. The preset group number sequence and the storage space corresponding to each group in the preset group number sequence constitute a time difference distribution histogram. The length of the time difference interval corresponding to each group is the maximum time difference value t of the reference difference value interval. max The reference difference interval is the observable time difference range 0~t max The time difference data to be processed in the set of time difference data to be processed represents the time difference of the detected events recorded when the TCSPC circuit is running; A first determining module is configured to determine a set of difference intervals to be merged and a target difference interval from the reference difference intervals according to the set of time difference data to be processed; The set of difference intervals to be merged is a difference interval in which the number of time difference data to be processed corresponding to the reference difference interval is less than a preset number threshold, and the target difference interval is a difference interval in which the number of time difference data to be processed corresponding to the reference difference interval is greater than the preset number threshold; A second determining module is configured to determine, from the preset group number sequence, a group number sequence corresponding to each difference interval to be merged and a group number sequence corresponding to the target difference interval; A first adjustment module is configured to adjust the group number sequence corresponding to each difference interval to be merged and the group number sequence corresponding to the target difference interval to obtain a merged group number sequence corresponding to each difference interval to be merged and a target group number sequence corresponding to the target difference interval; Among them, the storage space corresponding to the merged group number sequence corresponding to each difference interval to be merged is larger than the storage space corresponding to the group number sequence corresponding to each difference interval to be merged; the number of groups in the target group number sequence is larger than the number of groups in the group number sequence corresponding to the target difference interval; the sum of the number of groups in the merged group number sequence and the number of groups in the target group number sequence is smaller than the number of groups in the preset group number sequence.
7. The device according to claim 6, characterized in that The first determining module is configured to determine a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval according to the set of time difference data to be processed; Among them, the number of time difference data to be processed corresponding to the first difference interval to be merged is less than a preset number threshold, the number of time difference data to be processed corresponding to the second difference interval to be merged is less than the preset number threshold, and the number of time difference data to be processed corresponding to the target difference interval is greater than or equal to the preset number threshold.
8. The device according to claim 7, characterized in that The first adjustment module includes: A first merging submodule, configured to use the first two groups in the preset group number sequence as a first merging group number sequence corresponding to the first difference interval to be merged; A second merging submodule, configured to use the last two groups in the preset group number sequence as a second merging group number sequence corresponding to the second difference interval to be merged; The first determining submodule is configured to use the groups in the preset group number sequence except the two groups at the head and the two groups at the tail as the target group number sequence corresponding to the target difference interval.
9. The device according to claim 7, characterized in that The device further comprises: The second adjustment module includes: a second determining submodule configured to, after determining a first difference interval to be merged, a target difference interval, and a second difference interval to be merged from the reference difference interval based on the set of time difference data to be processed, determine a first difference subinterval to be merged and a second difference subinterval to be merged from the first difference interval to be merged; wherein a lower limit value of the second difference subinterval to be merged is greater than or equal to an upper limit value of the first difference subinterval to be merged; a third determining submodule, configured to determine, from the preset group number sequence, a group number sequence corresponding to the first difference subinterval to be merged and a group number sequence corresponding to the second difference subinterval to be merged; an adjusting submodule, configured to adjust the group number sequence corresponding to the first difference subinterval to be merged and the group number sequence corresponding to the second difference subinterval to be merged, to obtain a first merged group number subsequence corresponding to the first difference subinterval to be merged and a second merged group number subsequence corresponding to the second difference subinterval to be merged; Among them, the storage space corresponding to the first merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the first difference subinterval to be merged; the storage space corresponding to the second merged group number subsequence is larger than the storage space corresponding to the group number sequence corresponding to the second difference subinterval to be merged.
10. The device according to claim 9, characterized in that The second adjustment module further includes: a storage submodule configured to, after obtaining a first merging group number subsequence corresponding to the first difference subinterval to be merged and a second merging group number subsequence corresponding to the second difference subinterval to be merged, perform storage processing on the to-be-processed time difference data set and determine a stored space corresponding to the second difference subinterval to be merged; An updating submodule is configured to update the target difference interval to obtain an updated target difference interval if the ratio of the stored space corresponding to the second difference subinterval to be merged to the storage space corresponding to the second difference subinterval to be merged is greater than a preset ratio threshold; the updated target difference interval includes the second difference subinterval to be merged and the target difference interval.
11. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the storage space allocation method described in any one of claims 1-5.
12. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the storage space allocation method as described in any one of claims 1-5.
Citation Information
Patent Citations
System and method for measuring time flight distance of time code
CN110609291A
Information storage method and device, electronic equipment, storage medium and program product
CN113590890A