Could Someone Give me Advice on Implementing Custom AstroPy Function for Spectral Data Analysis?

Hello there, :wave:

I am working on a project that involves analyzing a large dataset of stellar spectra; and I am using AstroPy extensively for data manipulation. While the built in tools have been incredibly helpful; I have hit a point where I need a custom function to better handle a specific type of data processing, and I am unsure how to implement it efficiently.

I have a collection of FITS files containing spectral data, and I need to apply a custom smoothing algorithm that is a bit different from the standard convolution or Gaussian smoothing.

I am looking to create a function that applies a variable width smoothing kernel based on the wavelength dependent noise level, which varies across the spectrum.

What is the best way to define a custom smoothing kernel that dynamically adjusts based on wavelength? :thinking: Are there any examples of integrating custom kernels with AstroPy’s convolution module?

How can I efficiently apply this custom function to large datasets without running into memory issues? :thinking: Are there AstroPy native methods that could help optimize performance?

Also, I have gone through this post; https://community.openastronomy.org/t/retrieve-and-open-a-cube-from-astropy-data-pvdiagramplotting-tableau which definitely helped me out a lot.

Has anyone here implemented a similar solution; or could you point me to any resources or existing projects that tackle custom spectral data processing?

Thanks in advance for your help and assistance. :innocent: