## Set operations

Set operations allow sets to be created, destroyed, written to disk, sorted.

- Pick ops
  - Kill nearest set
  - Copy nearest set
  - Move nearest set
  - Reverse nearest set
  - De-activate nearest set
  - Join nearest sets
  - Delete range in nearest set
  - Cancel operation
- Activate
- De-activate
- Re-activate
- Set length
- Change Set type
- Copy
- Move
- Drop points
- Join
- Split
- Kill
- Kill all
- Sort
- Write set(s)
- Reverse order
- Coalesce sets
- Swap
- Pack

### Pick ops

Pick ops use the point in a set nearest to the location of the pointer when clicked to select the set for the chosen operation. The nearest point is determined by the Euclidean distance which can be very different from the point that is visually closer. As long as there are sets with points, the operation will always be performed, which means that a bit of care should be exercised using these operations.

- Kill nearest set

  Kill the set nearest the pointer.

- Copy nearest set

  Select a set to copy with one click, and the destination, which may be in another graph, with another click.

- Move nearest set

  Select a set to move with one click, and the destination, which may be in another graph, with another click.

- Reverse nearest set

  Select a set to reverse by clicking near a point in a set. The result is that the order of the points is reversed (point N becomes point 1, and point 1 becomes point number N, etc.).

- De-activate nearest set

  Select a set to deactivate by clicking near a point in a set. The result is that the set will act as if undefined for most operations, and will not be drawn even if the line or symbol selections would cause it to be drawn. The data are not destroyed, and the set can be reactivated using the functions in File/Status or Data/Set ops.

- Join nearest sets

  Click near a point in one set to use for the join, then click again near a point in another set to select the second set. The second set will be appended to the end of the first set.

- Delete range in nearest set

  Click near a point in one set to use for the start of the range to delete, then again near the point at the end of the range to delete. The result is that all points between the 2 selected points will be removed from the set, including the 2 points selected.

- Cancel operation

  Cancel any operation in progress.

The remaining items in the Set ops toolbox allow sets to be created, destroyed, written to disk, moved, sorted, deactivated, reactivated.

### Activate

Make a set active and able to participate in operations.

To activate a set, select the set number, specify the number of points in the set and click on "Accept."

### Deactivate

Make a set inactive and unable to participate in operations. The data associated with a deactivated set are still available and all plot parameters associated with the set are unchanged. Use the Re-activate set item below to make the set known to xmgr again. This item is include for those situations where a set is to be ignored temporarily, but needed later in the session.

Select the set to Deactivate.

Press the button marked Accept.

### Re-activate

Undo the effect of Deactivate.

Select the set to Reactivate, it is a no-op to Reactivate an unused set.

Press the button marked Accept.

### Set length

Set the length of a set.

Select the set.

Fill in the item marked Length.

Press the button marked Accept.

### Change Set type

Set the type of a set.

Select the set

Select the type to set

Press the button marked "Accept"

### Copy

Copy one set to another in a possibly different graph.

Select the set to copy from.

Select the set to copy to.

Select the graph to receive the copy.

Press the button marked Accept.

### Move

Move one set to another in a possibly different graph.

Select the set to move from.

Select the set to move to.

Select the graph to receive the set.

Press the button marked Accept

### Swap

Exchange one set with another.

Select the sets and the graphs these sets reside.

Click on Accept.

The contents of the sets plus all parameters associated with the display of the sets are exchanged.

### Drop points

Drop points from a set.

Select the set.

Fill in the items "Start drop" and "End drop".

Press the button marked Accept.

NOTE: Points in a set are numbered from 1 to N, where N is the number of points in the set (as opposed to sets which are numbered from 0).

### Join

Merge 2 sets together.

Select the set that will be appended.

Select the set accepting the previous set.

Press the button marked Accept to append the first set to the second.

### Split

Divide a set into other sets.

Select the set to split.

Enter the length of the resulting sets (say N).

Press the button marked Accept to divide the selected set into (length of selected set) / N sets with the remainder to the last set.

The first set will be the set selected to split and will contain the first N points.

### Kill

Eliminate a set.

Select the set to kill or All to kill every active set.

To save the parameter settings, toggle `Preserve parameters.'

Press the button Accept.

NOTE: This operation is final.

### Kill all

Kill all active sets.

This is an action item, you'll be asked if it is OK to kill all active sets.

### Sort

sort x or y of a set.

Select set to sort.

Select which component (x or y) as a key.

Select the order of the sort.

Press the button marked Accept to sort the set in place.

### Write set(s)

Write a set(s) to disk.

Select the set to write or "All" for all sets.

Fill in the format to use to write, syntax is C, default is "%lf %lf".

Fill in the item marked "Write to file" with the filename to write.

Press the button marked Accept.

Note: A complete dump of xmgr may be accomplished by selecting All sets, All active graphs and toggling Embed parameters. The generated file may be read as a normal data file and will contain the necessary information to completely reconstruct all graphs in the current session.

### Reverse order

Exchange points in a set.

Select set to reverse.

Press the button marked Accept to reverse the order of a set.

### Coalesce sets

Merge active sets to an inactive set.

Select set to receive points from all active sets. This selected set should not be an active set.

Press the button marked Accept to merge all sets to the selected set.

### Pack sets

Move sets so that the set structure in the current graph has no gaps.

During the course of several operations on sets, gaps can form in the set structure. This can result cause problems when doing a Save all, as the actual location, i.e. set number, of the set is not retained in the Save file. For example after several operations that create and delete sets, the active sets are numbered: 0, 3, 4, 5, 9 Following a Pack, the active sets will be numbered: 0, 1, 2, 3, 4.

Press the button marked Accept to pack all sets in the current graph.