Discussion points for Q-1 software

I am very happy with our openQCM Q-1 - it's working really well! However, we now want to use 6 MHz crystals and I just can not find the position in the python code where this is changed. Any help would be greatly appreciated!

Also, I wonder if there are any plans so that the fundamental as well as selected overtones can be measured in the software at the same time? I realize this would mean continuously switching through the various frequency ranges.

Comments

  • Hi Chris2020, sorry for my reply delay.
    Fist thank you. We are very happy that you are enjoying with openQCM. We have always aimed to obtain open-source instruments that have similar performance to commercial scientific devices. So, your comment is very encouraging!
    Anyway regarding your question, It is absolutely possible to use 6 MHz. Actually Marco is out of labs for a meeting. Tomorrow he will answer you in detail and explain how to proceed with the modification of the code. Regarding your second question, you perfectly centered the concept. We are working in order to release the new code for multi-harmonic analysis very soon.
  • Thanks Raffaele! I am looking forward to hearing back from Marco. And also to the release of the multi-harmonic analysis..
  • Hello, I am also wondering how I will be able to change the resonant frequency for 6MHz crystals. Help is much appreciated. Thank you.
  • Hi SamB,
    sure, we will share the code here for who will be interested.
  • Hello Raffaele, Thank you for your reply. Where might I be able to find the location of the file containing the code to be changed?

    Regards,

    SamB
  • I have seen that in "constants.py" you can change the frequency windows for the measurements (left and right frequencies). In order to change to 6 MHz, is it as simple as changing the window there? Will it then simply find the most intense peak in the specified window?
  • Hi,
    it is possible to modify the source code so that you can use 6 MHz. It is quite simple, but you need to modify several points in the source code.

    Here the instructions:
    the cource code files you need to modify are:
    • constants.py
    • Calibration.py
    • switcher.py
    constants.py

    you need to add the source lines code below to include the sweeping parameters for 6 MHz QCM
     
        #--------------
        # 6MHz 
        #--------------
        # CUSTOM modification for 6 MHz quartz crystal 
        # left and right frequencies
        L6_fundamental = 5500
        R6_fundamental = 2500
        # Savitzky-Golay size of the data window 
        SG_window_size5_fundamental = 9
        # Spline smoothing factor
        Spline_factor5_fundamental = 0.05
        # left and right frequencies
        L6_3th_overtone = 7500
        R6_3th_overtone = 2500
        # Savitzky-Golay size of the data window 
        SG_window_size5_3th_overtone = 11
        # Spline smoothing factor
        Spline_factor5_3th_overtone = 0.01
        
        # left and right frequencies
        L6_5th_overtone = 10000
        R6_5th_overtone = 2500
        # Savitzky-Golay size of the data window 
        SG_window_size5_5th_overtone = 11
        # Spline smoothing factor
        Spline_factor5_5th_overtone = 0.01
        
        # left and right frequencies
        L6_7th_overtone = 50000
        R6_7th_overtone = 2500
        # Savitzky-Golay size of the data window 
        SG_window_size5_7th_overtone = 33
        # Spline smoothing factor
        Spline_factor5_7th_overtone = 0.01
        
        # TODO
        # left and right frequencies 
        L6_9th_overtone = 5000000
        R6_9th_overtone = 100000
        # Savitzky-Golay size of the data window 
        SG_window_size5_9th_overtone = 5
        # Spline smoothing factor
        Spline_factor5_9th_overtone = 0.5
    and the code lines below for the calibration parameter
    
        ##########################
        # CALIBRATION PARAMETERS #
        ##########################
        
        # Peak Detection - distance in samples between neighbouring peaks
        dist3  =  5000  # for @3MHz
        dist5  =  8000  # for @5MHz
        dist6 = 8000    # for @6MHz 
        dist8  =  8000  # for @8MHz
        dist10 =  10000 # for @10MHz
    Calibration.py
    here you need to add the following lines to call the 6 MHz QCM during the calibration procedure
    distance = Constants.
    path = Constants.
    path_calib = Constants.
    filename_calib = Constants.csv_calibration_filename6  #6MHz
    and include the fundamental frequency parameter range for the verification of the calibration procedure
    # 6 MHz corresponds to type number 2
                         if ((self._QCStype_int == 0) and len(max_freq_mag)==4 and (max_freq_mag[0]>2e+06 and max_freq_mag[0]<4e+06))    \
                            or ((self._QCStype_int == 1) and len(max_freq_mag)==5 and (max_freq_mag[0]>4e+06 and max_freq_mag[0]<6e+06)) \
                            or ((self._QCStype_int == 2) and len(max_freq_mag)==5 and (max_freq_mag[0]>5e+06 and max_freq_mag[0]<7e+06)) \
                            or ((self._QCStype_int == 3) and len(max_freq_mag)==3 and (max_freq_mag[0]>9e+06 and max_freq_mag[0]<11e+06)):
    switcher.py
    you need to add the following lines of code to switch between overtones in measurement mode
    ###############################################################################
    # Switches from overtone frequency to frequency range for 6MHz QC Sensor
    ###############################################################################
    class Overtone_Switcher_6MHz:
        
        def __init__(self,peak_frequencies = None):
            self.peak_frequencies = peak_frequencies
        
        # from fundamental frequency to the 9th overtone    
        def overtone5MHz_to_freq_range(self, argument):
            method_name = 'overtone_' + str(argument)
            # Get the method from 'self'. Default to a lambda.
            method = getattr(self, method_name, lambda: None)
            # Call the method as we return it
            return method()
     
        def overtone_0(self):
            # fundamental frequency
            name = "fundamental"
            start = self.peak_frequencies[0] - Constants.L6_fundamental
            stop  = self.peak_frequencies[0] + Constants.R6_fundamental
            return name, self.peak_frequencies[0], start, stop, Constants.SG_window_size6_fundamental, Constants.Spline_factor6_fundamental
     
        def overtone_1(self):
            # 3th Overtone
            name = "3th Overtone"
            start = self.peak_frequencies[1] - Constants.L6_3th_overtone
            stop  = self.peak_frequencies[1] + Constants.R6_3th_overtone
            return name, self.peak_frequencies[1], start, stop, Constants.SG_window_size6_3th_overtone, Constants.Spline_factor6_3th_overtone
        
        def overtone_2(self):
            # 5th Overtone
            name = "5th Overtone"
            start = self.peak_frequencies[2] - Constants.L6_5th_overtone
            stop  = self.peak_frequencies[2] + Constants.R6_5th_overtone
            return name, self.peak_frequencies[2],start,stop, Constants.SG_window_size6_5th_overtone, Constants.Spline_factor6_5th_overtone
    
        def overtone_3(self):
            # 7th Overtone
            name = "7th Overtone"
            start = self.peak_frequencies[3] - Constants.L6_7th_overtone
            stop  = self.peak_frequencies[3] + Constants.R6_7th_overtone
            return name, self.peak_frequencies[3],start,stop, Constants.SG_window_size6_7th_overtone, Constants.Spline_factor6_7th_overtone
    
        def overtone_4(self):
            # 9th Overtone
            name = "9th Overtone"
            start = self.peak_frequencies[4] - Constants.L6_9th_overtone
            stop  = self.peak_frequencies[4] + Constants.R6_9th_overtone
            return name, self.peak_frequencies[4], start, stop, Constants.SG_window_size6_9th_overtone, Constants.Spline_factor6_9th_overtone
    I've attached the source code python file that has been changed to work with 6 MHz QCM
    please let me know how it works

    cheers,
    marco
  • Hi Marco,
    Thank you so much! That's very helpful. We'll give it a go tomorrow ;-)
    Best, Chris
Sign In or Register to comment.