Issue with flatness metric for smaller fields

I have been generating some figures for some profile measurements; however, I am finding that the flatness does not seem to work for “smaller” field sizes.

It works perfectly fine for larger than 10x10, just not for smaller field sizes (such as a 10x10 electron field).

Update: As shown in the plot, the lower value for tthe flatness is incorrect as it should reside on the profile. The result in getting is 14% (it should be less than 1%).

Any thoughts?

Some of my code below (taken from an excel file).

df = pd.read_csv('{}/{}.csv'.format(path, fn))
# Convert the Dataframe into a numpy array
a = df.to_numpy()
# Create the profile data using PyLinac functions (FFF)
profile1 = InflectionDerivativeProfilePhysical(values = a[:,1], x_values = a[:,0])
profile1.compute(metrics=[FlatnessDifferenceMetric(in_field_ratio=0.2)])
# Extra small field ratio to show the confusion


m

Hi,

I do not understand what your Question actually is. What results do you get for your Flatness? Did you compare the pylinac results to calculations done by hand? According to the plot I would assume the Flatness is excellent?
Formula: Profiles & 1D Metrics - pylinac 3.28.0 documentation

regards
Thomas

Sorry, but if you look at the green box in the figure, the lower point makes no sense. The two points in the box should be localized to the profile.

Flatness should be close to 1, but I’m get 14 as a result.

Hi,
I tested with some watertank scans of a 4x4 field. I don’t get the same results from pylinac compared to a calculation without pylinac but I get resonable results (1.64 with pylinac and 1.48 when doing the calculation “by hand”).
I tested with pylinac 3.28 and 3.25
I also see no difference between in_field_ratios of 0.8 and 0.2.

What happens if you don’t give x_values and instead use the dpmm option?

Thanks for looking into this :slight_smile: . Happy to hear it is not just me!

I did try it using dpmm option, but I get the same result. I also tried the various profile functions, but all give me more or less the same issue.