Skip to content

Add functionality of LLHplotting and energy conv & scale instant subm… - #54

Open
Po-WeiHuang wants to merge 1 commit into
willp240:mainfrom
Po-WeiHuang:LLHplot_RunSelection
Open

Add functionality of LLHplotting and energy conv & scale instant subm…#54
Po-WeiHuang wants to merge 1 commit into
willp240:mainfrom
Po-WeiHuang:LLHplot_RunSelection

Conversation

@Po-WeiHuang

Copy link
Copy Markdown
Contributor

Hello Will,
Two functionalities I have added here:

  1. util/makeconfig_forrunselection.py: Changing conv and scale values and instantly submit condor jobs. This is useful for doing runlist estimation to validate what is our tolerance of scale&conv depending on fitting parameters.
  2. util/plotFixedOscLLHWhole.py: A script of plotting a magnificent image, whose upeer left and bottom right are ProfiledLLH, projected from a 2D LLH graph at bottom left. Upper right pad shows the colourmap user is using on the 2D graph. User should put their Times_New_Roman_Normal.ttf and replace to personal_path to get Times New Roman on.
    The plot should look similar to this:
    Screenshot from 2025-05-26 16-17-36

# -newdir /home/huangp/antinullh/cfg/2p2energyscale_1p5plus
# -o /data/snoplus/weiiiiiii/antinuFit/run_selection/2p2energyscale_1p5plus
# -scale 1.015 -conv 0.045

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could have the input flags be the same as for submitFixedOscJobs.py, then have different flags for the new additional options (maybe like -c or -d for old config dir, -n for new config dir, can keep -scale and -conv). That way there's no hard coded paths later when you call submitFixedOscJobs.py

import os
import shutil
import configparser
import subprocess

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think subprocess is needed

config = configparser.ConfigParser()

# Read the config file
config.read(f"{args.newdir}/fit_config.ini") # Replace with the actual file path

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be better for the user to enter the full fit config file path and name, then it doesn't matter if the input config isn't called fit_config.ini

print(command)
# Run the command
os.system(command)
print("Command is now running")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will have run by the time it prints "is now running" but ok 😄

import argparse
def SNOPLUSSTYLE():
#personal_path = os.path.dirname(os.path.realpath(__file__))
personal_path = "~/Library/Times_New_Roman_Normal.ttf"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may as well commit that file in utils?

# Format the y-axis tick labels to be scaled
def scaled_formatter(x, pos):
#The two args are the value and tick position
#print('%1.0f' % (x/1e-5))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can delete this commented print out

profile_deltam = np.min(hist2d_avg, axis=0) # Min over theta
theta_centers = 0.5 * (xedges[:-1] + xedges[1:])
deltam_centers = 0.5 * (yedges[:-1] + yedges[1:])
#print(profile_theta-profile_deltam)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can delete this commented print out

#plt.tight_layout()
#plt.show()
plt.savefig(os.path.join(output_dir, "OscLLH.png"))
plt.savefig(os.path.join(output_dir, "OscLLH.pdf"))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe call it like FullLLH or LLHandProjections, or something just to make it clear from the name what makes it different to the outputs of plotFixedOscLLH.C

@willp240

Copy link
Copy Markdown
Owner

I have some thoughts on the cosmetics of the output plot:

  • can you add axis labels for the projections?
  • can you add more ticks and labels for the colour palette?
  • can you add units (degrees) to the theta axis label
  • can you make the ticks on the back-to-back axes line up with each other as they represent the same axes

looking good though! We can call to discuss if it helps

P.S How much of the code was chat-gpt 😝

@willp240

Copy link
Copy Markdown
Owner

Oh and can you add to the HowTo guide a bit on using these

@Po-WeiHuang

Copy link
Copy Markdown
Contributor Author

Hi Will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants