Hi Elsie
Well spotted! Thanks for letting me know!
I had a look in the code, and the only difference is that Praat, when drawing the formants, does not draw frames with an "intensity" lower than a certain threshold. In the "View & Edit" window, this threshold is set by the "Dynamic range (dB)" setting. Every Praat formant frame has an intensity calculated (check with "Inspect" on a formant object in the main "Object window"), and when drawing, Praat gets the maximum intensity over the time window that's being drawn, converts the dynamic range decibel value into a factor, and takes this as a cutoff for now drawing the formants. I would presume this is done to not draw formants during silence.
Crucially, I do not think this should affect in any way the formant values calculated. It should just affect the frames that get plotted. (If you find out this is not the case, and the values differ, do let me know! This would be a bug and important to investigate and fix in Parselmouth!)
Annoyingly, this "intensity" of a Formant object's frame is not too easily accessed, as Praat doesn't have any buttons in the GUI to do so. I can see two ways to go about this, if you want to do the same as Praat in Python:
1) Take a detour and go through a "Table". At a quick glance this seems to make sense to extract the F1 values for a given THRESHOLD:
```
formant_table = parselmouth.praat.call(formant, "Down to Table", True, True, 6, True, 15, True, 3, True)
frame_intensities = np.array([float(parselmouth.praat.call(formant_table, "Get value", i + 1, "intensity")) for i in range(formant.nx)])
frame_threshold = np.max(frame_intensities) / 10**(DYNAMIC_RANGE / 10)
selected_frames = frame_intensities >= frame_threshold
formant_values = np.array([formant.get_value_at_time(1, t) for t in formant.ts()])
formant_values[~selected_frames] = np.nan
plt.figure()
plt.plot(formant.xs(), formant_values, '.')
plt.ylim(0, 5500)
plt.show()
```
2) Calculate your own Intensity (or even use "To TextGrid (silences)",
https://www.fon.hum.uva.nl/praat/manual/Sound__To_TextGrid__silences____.html), and decide based on this. It won't exactly match Praat unless you manage to perfectly match the window length and step size of the intensity and formant analysis, but it might be easier with Parselmouth (not going through this table thing), you have more control, and it's the same in spirit as Praat (i.e., not using the formant values if an analysis window is too silent).
I completely agree it's annoying you need to have these workarounds, but in my/Parselmouth's defense: Praat only does this when plotting (i.e., you can still query the formant at these points) and I don't see an easier way of getting to these intensity values manually withing Praat GUI/scripting either, if you want to extract them and plot externally (so at least Parselmouth is not making it harder).
If anything's unclear, or you have follow-up questions or issues, do not hesitate to let me know!
Kind regards
Yannick