Skip to content

Commit

Permalink
Remove any remaining chips other than 1,3,6,9
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Jul 11, 2023
1 parent 64c6bc7 commit 3d1c48b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def get_chip_prog_values(
):
name = inspect.stack()[0][3]
logger.info("%s" % name)
if chip_type in ["0", "1", "5", "7", "8", "10"]:
if chip_type in ["1", "3", "9"]:
# '1' = 'Oxford ' = [8, 8, 20, 20, 0.125, 3.175, 3.175]
(
xblocks,
yblocks,
Expand All @@ -67,34 +68,9 @@ def get_chip_prog_values(
x_block_size = ((x_num_steps - 1) * w2w) + b2b_horz
y_block_size = ((y_num_steps - 1) * w2w) + b2b_vert

"""
'0' = 'Toronto' = [9, 9, 12, 12, 0.125, 2.2 , 2.5 ]
'1' = 'Oxford ' = [8, 8, 20, 20, 0.125, 3.175, 3.175]
'2' = 'Hamburg' = [3, 3, 53, 53, 0.150, 8.58 , 8.58 ]
'5' = 'Regina ' = [7, 7, 20, 20, 0.125, 3.7 , 3.7 ]
"""

elif chip_type == "2":
if caget(pv.me14e_gp2) == 2:
print("Full Mapping on Hamburg -> xblocks = 6")
logger.info("%s Full Mapping on Hamburg -> xblocks = 6" % name)
xblocks = 6
else:
xblocks = 3

elif chip_type == "4":
print("This is a Bismuth Chip")
logger.info("%s This is a Bismuth Chip" % name)
x_num_steps = caget(pv.me14e_gp6)
y_num_steps = caget(pv.me14e_gp7)
x_step_size = caget(pv.me14e_gp8)
y_step_size = x_step_size
xblocks = 7
yblocks = 7
x_block_size = 15 # placeholder
y_block_size = 15 # placeholder

elif chip_type == "6":
# This is set by the user in the edm screen
# The chip format might change every time and is read from PVs.
print("This is a Custom Chip")
logger.info("%s This is a Custom Chip" % name)
x_num_steps = caget(pv.me14e_gp6)
Expand Down Expand Up @@ -221,7 +197,7 @@ def get_prog_num(chip_type, map_type, pump_repeat):
name = inspect.stack()[0][3]
logger.info("%s Get Program Number" % name)
if str(pump_repeat) == "0":
if chip_type in ["0", "1", "2", "5", "10"]:
if chip_type in ["1", "3"]:
if map_type == "0":
logger.info("%s\t:Map Type = None" % name)
print("Map Type is None")
Expand All @@ -242,18 +218,10 @@ def get_prog_num(chip_type, map_type, pump_repeat):
print("Unknown map_type")
print(map_type)
return 0
elif chip_type == "4":
logger.info("%s\t:Bismuth Chip Type 2" % name)
print("Bismuth Chip Type 2")
return 12
elif chip_type == "6":
logger.info("%s\t:Custom Chip" % name)
print("Custom Chip Type")
return 11
elif chip_type in ["7", "8"]:
logger.info("%s\t:Heidelberg Chip" % name)
print("Heidelberg Chip Type")
return 11
else:
logger.debug("%s\t:Unknown chip_type, chip_tpe = = %s" % (name, chip_type))
print("Unknown Chip Type")
Expand Down Expand Up @@ -288,7 +256,6 @@ def datasetsizei24():
) = scrape_parameter_file()

if map_type == "0":
chip_format = get_format(chip_type)[:4]
if chip_type == "6":
# Chip Type 6 is Custom
print("Calculating total number of images")
Expand All @@ -299,6 +266,7 @@ def datasetsizei24():
)
print(total_numb_imgs)
else:
chip_format = get_format(chip_type)[:4]
total_numb_imgs = np.prod(chip_format)

elif map_type == "1":
Expand All @@ -321,22 +289,13 @@ def datasetsizei24():

total_numb_imgs = np.prod(chip_format) * block_count * n_exposures

# For X-ray pump X-ray probe XPXP comment out total_numb_imgs = line above and uncomment below until double line of #####
# print('X-ray Pump Probe. XPXP. X-ray Pump Probe. XPXP.')
# if pump_repeat == '0':
# total_numb_imgs = np.prod(chip_format) * block_count * n_exposures
# elif pump_repeat in ['1','3', '4', '5', '6', '7']:
# total_numb_imgs = np.prod(chip_format) * block_count * n_exposures * 2
# else:
# print('Unknown pump_repeat')

elif map_type == "2":
logger.warning("%s\t:Not Set Up For Full Mapping=%s" % (name))
print("FIX ME, Im not set up for full mapping ")
raise ValueError("The beamline is currently not set for Full Mapping.")

else:
logger.warning("%s Unknown Map Type, map_type = %s" % (name, map_type))
print("Unknown map type")
raise ValueError("Unknown map type")

print("Total number of images", total_numb_imgs, "\n\n\n")
caput(pv.me14e_gp10, total_numb_imgs)
Expand Down Expand Up @@ -646,7 +605,7 @@ def main():

# If alignment type is Oxford inner it is still an Oxford type chip
if str(chip_type) == "3":
logger.debug("%s\tMain: Change chip type Oxford Inner to Oxford" % name)
logger.debug("%s\tMain: Change chip type Oxford Inner to Oxford." % name)
chip_type = "1"

chip_prog_dict = get_chip_prog_values(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def load_lite_map(litemap_path: Path | str = LITEMAP_PATH):
'H1': '64', 'H2': '63', 'H3': '62', 'H4': '61', 'H5': '60', 'H6': '59', 'H7': '58', 'H8': '57',
}
# fmt: on
chip_type = caget(pv.me14e_gp1)
chip_type = int(caget(pv.me14e_gp1))
if chip_type == 1 or chip_type == 3:
logger.info("%s Oxford Block Order" % name)
print("Oxford Block Order")
Expand Down Expand Up @@ -661,8 +661,8 @@ def moveto(place: str):
caput(pv.me14e_stage_y, 25.40)

else:
print("Unknown chip_type move")
logger.warning("%s Unknown chip_type move" % name)
raise ValueError("Unknown chip_type move")

# Non Chip Specific Move
if place == "zero":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def convert_chip_to_hex(fid, chip_type):
check_files(["%s.full" % chip_type])
with open("%s.full" % fid[:-5], "w") as g:
# Normal
if chip_type in ["0", "1", "5"]:
if chip_type in ["1", "3"]:
shot_order_list = get_shot_order(chip_type)
logger.info("%s Shot Order List: \n" % (name))
logger.info("%s" % shot_order_list[:14])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ def get_format(chip_type):
b2b_horz = 0.0
b2b_vert = 0.0
chip_format = [1, 1, 25, 25]
elif chip_type == "6": # Custom
w2w = 0.100
b2b_horz = 0
b2b_vert = 0
chip_format = [1, 1, 20, 20]
elif chip_type == "9": # Mini oxford (1 block)
w2w = 0.125
b2b_horz = 0
Expand Down

0 comments on commit 3d1c48b

Please sign in to comment.