I wish to create plots in the analyze section of my experiment using matplotlib. Specifically, I want the title of my plot to include the run ID of the experiment. Is there a way to obtain the runID of the experiment for use in the analyze function? I saw something about using current_scan.rid() from NIST, but this doesn't seem to work. Any help is greatly appreciated! The plotting section of my code looks like this currently:

plt.plot(x,fit,label = "fit")
plt.plot(x,y,label = "data")
plt.title(f"Raman Rabi Flops with Fit, RID = {rid}")
plt.axhline(y = 0.99, color = 'red',linestyle = '--',label = "99% fidelity")
plt.legend()
plt.grid()
plt.xlabel("Pulse time (us)")
plt.ylabel("Probability")
plt.show()
rid = self.current_scan.rid()
if not os.path.exists(plot_dir):
os.makedirs(plot_dir)
plot_filename = os.path.join(plot_dir,f"Experiment #{rid}.png")
plt.savefig(plot_filename)

Figured it out myself!!
Use the last_rid.pyon file

    def read_integer_from_pyon(file_path):
        with open(file_path, 'r') as file:
            return int(file.readline().strip())

    # Example usage:
    file_path = "file_path\\last_rid.pyon"  
    integer_value = read_integer_from_pyon(file_path)
    print(integer_value)

The usual way to do it would be through the scheduler's virtual device, which has an attribute rid. See the manual.