Error in storing the frequency axis due to its sampling #1

Open
opened 2026-02-27 03:39:24 +00:00 by linarphy · 3 comments
Owner

I use geomspace (from numpy) to generate log-spaced frequency values to generate my transfer functions. But then, I store this frequency sampling information using df and f0 in the hdf5 file, as if the frequencies were linearly sampled (using mean of diff to compute a "df" which is meaningless).

This is a big issue and can explain the difference between Matlab and Python. I have to check this quickly.

I use geomspace (from numpy) to generate log-spaced frequency values to generate my transfer functions. But then, I store this frequency sampling information using df and f0 in the hdf5 file, as if the frequencies were linearly sampled (using mean of diff to compute a "df" which is meaningless). This is a big issue and can explain the difference between Matlab and Python. I have to check this quickly.
Author
Owner
  1. I can use linspace, which will be a "one line change". This is more space-efficient for storage, but less precise as logarithm-spaced frequeny axis is very useful
  2. sacrifice space for completness, store the whole frequency axis for each transfer function
  3. create a new df_log instead of "df" to store the log equivalent. df_log = log(f[1]) - log(f[0]). One change to backscattering_simulation_data, and done:
    1. Create a new LogFrequencySeries which inherit from FrequencySeries ?
    2. Make the conversion happens only when storing the data in hdf5 -> store the whole frequency axis at runtime (seems easier and can be changed to 3.1. when I will have the time (one day -_-) )
  4. for now, I use the same frequency axis for every transfer function, so I can store it once (at a "scatterer" level). This means I will have to change backscattering_simulation_data again if I don’t use the same frequency axis anymore. Less storage for the same amount of information (for now, not future-proof)

I think 3.2 is the best (quite easy and keep the storage low AND the values log-spaced). For tomorrow, I’ll check locally with linspace (in finesse-simulation-O4) before working on this, I have to go fast for LVK

1. I can use linspace, which will be a "one line change". This is more space-efficient for storage, but less precise as logarithm-spaced frequeny axis is very useful 2. sacrifice space for completness, store the whole frequency axis for each transfer function 3. create a new df_log instead of "df" to store the log equivalent. df_log = log(f[1]) - log(f[0]). One change to backscattering_simulation_data, and done: 1. Create a new LogFrequencySeries which inherit from FrequencySeries ? 2. Make the conversion happens only when storing the data in hdf5 -> store the whole frequency axis at runtime (seems easier and can be changed to 3.1. when I will have the time (one day -_-) ) 4. for now, I use the same frequency axis for every transfer function, so I can store it once (at a "scatterer" level). This means I will have to change backscattering_simulation_data again if I don’t use the same frequency axis anymore. Less storage for the same amount of information (for now, not future-proof) I think 3.2 is the best (quite easy and keep the storage low AND the values log-spaced). For tomorrow, I’ll check locally with linspace (in finesse-simulation-O4) before working on this, I have to go fast for LVK
Author
Owner

Data converted to matlab file didn’t have this issue because it didn’t use hdf5 at all, (frequencies were stored like option 4. in the .mat) so no issue with the fsc I computed and presented at virgo week. I have to check how the interpolation was done to be sure it did accept log-spaced frequencies

Data converted to matlab file didn’t have this issue because it didn’t use hdf5 at all, (frequencies were stored like option 4. in the .mat) so no issue with the fsc I computed and presented at virgo week. I have to check how the interpolation was done to be sure it did accept log-spaced frequencies
Author
Owner

Je suis vraiment idiot

Je suis vraiment idiot
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
linarphy/backscattering_simulation#1
No description provided.