hop.hexabundle_allocation.problem_operations package

Subpackages

Submodules

hop.hexabundle_allocation.problem_operations.extract_data module

hop.hexabundle_allocation.problem_operations.extract_data.create_list_of_all_magnets_from_file(file, guideFileList)[source]
hop.hexabundle_allocation.problem_operations.extract_data.create_list_of_circular_and_rectangular_magnets_from_file(file, guideFileList)[source]
hop.hexabundle_allocation.problem_operations.extract_data.create_list_of_probes_from_file(file, guideFileList)[source]
hop.hexabundle_allocation.problem_operations.extract_data.get_file(filename)[source]
hop.hexabundle_allocation.problem_operations.extract_data.parse_col(s)[source]
hop.hexabundle_allocation.problem_operations.extract_data.parse_col_string(s)[source]
hop.hexabundle_allocation.problem_operations.extract_data.remove_apostrophes(s)[source]

hop.hexabundle_allocation.problem_operations.fibres module

hop.hexabundle_allocation.problem_operations.fibres.check_magnetCount_perAnnulus(self, tile_1_hexa, tile_2_hexa, tile_1_guide, tile_2_guide, annuliCount_batch)[source]
hop.hexabundle_allocation.problem_operations.fibres.check_tile_pair_magnet_counts(robot_file_1, robot_file_2)[source]
hop.hexabundle_allocation.problem_operations.fibres.convert_rectangularMagnetOrientation(magnet)[source]
hop.hexabundle_allocation.problem_operations.fibres.createHexabundleFigure_withChangeShown(self, tile_number_1, tile_number_2, subplateSkyfibre_figureFile_tile1, subplateSkyfibre_figureFile_tile2)[source]
hop.hexabundle_allocation.problem_operations.fibres.create_fibreSlit_info_file(fileNameHexa, fibre_file, output_fibreSlitInfo)[source]
hop.hexabundle_allocation.problem_operations.fibres.create_hexabundleFibre_coordData(output_hexabundle_coordData)[source]
hop.hexabundle_allocation.problem_operations.fibres.create_skyFibreSlitlet_figure(fileNameHexa, new_arrayAAOmega, new_arraySpector, skyFibre_AAOmegaFigure, skyFibre_SpectorFigure)[source]
hop.hexabundle_allocation.problem_operations.fibres.create_slitletFigure(new_arrayAAOmega, new_arraySpector, fibreFigure_AAOmega, fibreFigure_Spector)[source]
hop.hexabundle_allocation.problem_operations.fibres.createskyfibreChanges_plot(self, tile_1_hexa, tile_2_hexa, subplateSkyfibre_figureFile_tile1, subplateSkyfibre_figureFile_tile2, subplateSkyfibre_figureFile)[source]
hop.hexabundle_allocation.problem_operations.fibres.extract_fibreInfo(fibre_file, output_fibreAAOmega, output_fibreSpector)[source]
hop.hexabundle_allocation.problem_operations.fibres.plotHist_annuliCount_batch(self, annuliCount_batch, tile_batch, tileBatch_count)[source]
hop.hexabundle_allocation.problem_operations.fibres.plotHist_pistonChange_count_batch(self, pistonChange_countBatch, tile_batch, tileBatch_count)[source]
hop.hexabundle_allocation.problem_operations.fibres.plot_bar_from_dict(dict, ax=None)[source]

” This function creates a bar plot from a dictionary.

Parameters
  • dict – A dictionary with the item as the key and the frequency as the value

  • ax – an axis of matplotlib

Returns

the axis wit the object in it

hop.hexabundle_allocation.problem_operations.fibres.show_sky_fibre_changes(tile_1, tile_2)[source]

Make a plot to show the changes in sky fibres between two plates. Inputs:

tile_1 (str): Filename of the Hector Tile File (called Tile_FinalFormat…) file for plate 1 tile_2 (str): Filename of the Hector Tile File (called Tile_FinalFormat…) file for plate 2

Output:

(fig, ax)

hop.hexabundle_allocation.problem_operations.fibres.skyfibreChanges_pistonChange_count(self, tile_number_1, tile_number_2)[source]

hop.hexabundle_allocation.problem_operations.file_arranging module

hop.hexabundle_allocation.problem_operations.file_arranging.add_repositionCol_to_robotFile(positioning_array, robotFilearray, fully_blocked_magnets_dictionary)[source]
hop.hexabundle_allocation.problem_operations.file_arranging.arrange_guidesFile(fileNameHexa, fileNameGuides, guide_outputFile)[source]
hop.hexabundle_allocation.problem_operations.file_arranging.create_robotFileArray(tile_label, positioning_array, robotFile, newrow, fully_blocked_magnets_dictionary, robot_temp=-9999, obs_temp=-9999)[source]
hop.hexabundle_allocation.problem_operations.file_arranging.finalFiles(all_magnets, outputFile, fileNameHexa)[source]
hop.hexabundle_allocation.problem_operations.file_arranging.hasNumbers(inputString)[source]
hop.hexabundle_allocation.problem_operations.file_arranging.merge_hexaAndGuides(fileNameHexa, df_guideFile, plate_file)[source]
hop.hexabundle_allocation.problem_operations.file_arranging.positioningArray_adjust_and_mergetoFile(positioning_array, plate_file, outputFile, newrow, newrow_circular)[source]

hop.hexabundle_allocation.problem_operations.hexabundle module

hop.hexabundle_allocation.problem_operations.hexabundle.check_for_hexabundle_allocation_repeats(nested_dictionary)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.check_for_unallocated_hexabundle(nested_dictionary, HexaCount)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.cores91_hexabundles_sortedByMstar(MagnetDict)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.create_Magnet_Dictionary(all_magnets)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.get_probe_count(MagnetDict)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.hexabundle_allocation_fromMagnetDict(MagnetDict, magnet, guideIndex)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.overall_hexabundle_size_allocation_operation_version1(all_magnets, galaxyIDrecord, clusterNum, tileNum, flagsFile)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.overall_hexabundle_size_allocation_operation_version2_median(all_magnets, galaxyIDrecord, clusterNum, tileNum, flagsFile)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.overall_hexabundle_size_allocation_operation_version3_largerBundlePriority(all_magnets, galaxyIDrecord, mu_1re_cutoff, clusterNum, flagsFile)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.resolve_hexabundle_allocation_repeats(result, hexabundleRepeatwithsameID, MagnetDict)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.resolve_unallocated_hexabundle(unallocatedOnes, result, MagnetDict, indexx)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.star_hexabundle_allocation(MagnetDict, hexabundleDict)[source]
hop.hexabundle_allocation.problem_operations.hexabundle.update_galaxyIDrecord_withHexabundle(galaxyIDrecord, MagnetDict)[source]

hop.hexabundle_allocation.problem_operations.offsets module

hop.hexabundle_allocation.problem_operations.offsets.calculate_rectangular_magnet_center_coordinates(x, y, angs)[source]
hop.hexabundle_allocation.problem_operations.offsets.calculate_rectangular_magnet_orientation(angs)[source]

Transform the angle of the rectangular magnet into the correct frame (by subtracting pi)

hop.hexabundle_allocation.problem_operations.offsets.calculate_telecentricity_correction(magnet, telecentricity_correction_dictionary, centre=[0, 0], verbose=False)[source]

Find the required offset in the posotion of the circular magnets based on their telecentricity annulus

hop.hexabundle_allocation.problem_operations.offsets.hexaPositionOffset(all_magnets, offsetFile)[source]

Apply the P and Q offsets to the circular magnets and then move the rectangular magnets accordingly.

hop.hexabundle_allocation.problem_operations.offsets.magnetPair_radialPositionOffset_circularAnnulus(offset_circularAnnulus, all_magnets)[source]

Adjust the posotion of a circular magnet based on its telecentrocity annulus. Note- apply this function either here or in the radial offset standalone function but not both!

Inputs:
offset_circularAnnulus (dict):

A dictionary containing the amount each magnet moves depending on its telecentricity annulus. Must have keys ‘Blu’, ‘Yel’, ‘Gre’ and ‘Mag’

all_magnets (list):

list of all magnet objects

hop.hexabundle_allocation.problem_operations.plots module

hop.hexabundle_allocation.problem_operations.plots.annotate_text_in_plot(magnet, ax)[source]
hop.hexabundle_allocation.problem_operations.plots.coordinates_and_angle_of_skyFibres(angle, radii)[source]
hop.hexabundle_allocation.problem_operations.plots.create_magnet_pickup_areas(magnets)[source]
hop.hexabundle_allocation.problem_operations.plots.draw_all_magnets(magnets, clusterNum, fileNameHexa, robot_figureFile, hexabundle_figureFile, fig_hexa, ax_hexa, fig_robot, ax_robot)[source]

Make the two main plots from this code- the hexabundle plot and the robot pickup plot. For historical reasons, these are plotted at the same time in this single function rather than separately…

hop.hexabundle_allocation.problem_operations.plots.draw_circularSegments(ax)[source]
hop.hexabundle_allocation.problem_operations.plots.draw_circular_magnet(magnet, ax)[source]

Draw the circular magnets on the Hector field plate and label them

hop.hexabundle_allocation.problem_operations.plots.draw_magnet_pickup_areas(magnets, colour)[source]
hop.hexabundle_allocation.problem_operations.plots.draw_rectangular_magnet(magnet, ax)[source]

Draw a rectangular magnet on the hector plate. Annotate it with its number

hop.hexabundle_allocation.problem_operations.plots.get_magnet_properties(hexabundle)[source]

Return a dictionary of useful properties for each magnet

hop.hexabundle_allocation.problem_operations.plots.plot_skyfibre_section(fig, ax, skyfibreDict, angle, radius, angle_subplate, skyfibre_titles, delta_ang=20, colour_array=None)[source]

Draw the positions of one of the three Hector skyfibre subplates. There are three sections or “subplates” of skyfibres in Hector. Each is made up of four “wedges”, labelled by the spectrograph they feed (“A” or “H”) and a number. This function plots one section, corresponding to 4 wedges. In each wedge, there are a number of fibres which can be in the position 0, 1, 2, or 3.

Parameters
  • fig – A matplotlib figure object

  • ax – A matplotlib axis object

  • skyfibreDict (dict) – A dictionary of each skyfibre wedge and its fibres.

  • angle (float) – The angle of the entire subplate

  • radius (float) – The radius at which to draw the subplates. Should be 270 mm.

  • angle_subplate (list) – The angle of each sky fibre with respect to the overall angle variable above. Should be [7,5,3,1,-1,-3,-5,-7]

  • skyfibre_titles (list) – A list of each wedge name

  • delta_ang (float) – The difference in angle between adjacent wedges.

  • colour_array (list, optional) – A list of colours to plot each sky fibre as. Useful for plots showing the changes between two plates. If None, default to black for all fibres

Returns

ax

hop.hexabundle_allocation.problem_operations.plots.read_sky_fibre_file(filename)[source]

Read in a sky fibre file

hop.hexabundle_allocation.problem_operations.plots.sky_fibre_annotations(fig, ax, skyfibre_file)[source]

hop.hexabundle_allocation.problem_operations.position_ordering module

hop.hexabundle_allocation.problem_operations.position_ordering.calculate_placement_ordering_of_all_blocked_magnets(list_of_fully_blocked_magnets, list_of_conflicts)[source]
hop.hexabundle_allocation.problem_operations.position_ordering.calculate_placement_ordering_of_blocked_magnet(blocked_magnet, list_of_conflicts, list_of_fully_blocked_magnets)[source]
hop.hexabundle_allocation.problem_operations.position_ordering.create_position_ordering_array(all_magnets, fully_blocked_magnets, conflicted_magnets, MagnetDict, galaxyIDrecord, clusterNum, tileName, conflictFile)[source]

hop.hexabundle_allocation.problem_operations.robot_parameters module

hop.hexabundle_allocation.problem_operations.robot_parameters.add_pickupDirection(magnet, available_pickup)[source]
hop.hexabundle_allocation.problem_operations.robot_parameters.assign_magnet_labels(magnet, index1)[source]
hop.hexabundle_allocation.problem_operations.robot_parameters.assign_preferable_pickupDirection(available_pickup)[source]
hop.hexabundle_allocation.problem_operations.robot_parameters.calculate_pickup_putdown_angles(magnet, available_pickup)[source]
hop.hexabundle_allocation.problem_operations.robot_parameters.check_for_negative_twopi_angle(angle)[source]
hop.hexabundle_allocation.problem_operations.robot_parameters.check_for_unresolvable_conflict(magnet, conflictFile, max_order, clusterNum, tileName)[source]

Module contents