Skip to main content

midas-plotting

Standard plots for MIDAS reconstructions.

from midas_plotting import read_mic, orientation_map, compare_maps

m = read_mic("sampleC_mr.2.mic")
print(m.summary())
orientation_map(m, space_group=225, cmin=0.3)
midas-plot sampleC.0.mic sampleC_sum3thr2.0.mic --kind orientation --cmin 0.3 \
    --titles "baseline|sum3+thr2" -o compare.png

Why

IPF colouring, .mic parsing and map plotting had been re-implemented in several one-off analysis scripts, each with its own conventions. Two things that kept going wrong and are now handled in one place:

  • Euler→RGB is not an orientation map. Two orientations a fraction of a degree apart can produce very different Euler triplets near gimbal lock, so a single grain renders as several colours. ipf_rgb colours by the crystal direction along a sample axis instead.
  • A permissive confidence cut fills the whole grid. The fit returns an orientation for every voxel it evaluates, so plotting at C ≥ 0.1 shows plausible microstructure whether or not material is there. orientation_map annotates the figure when asked to plot below TRUST_FLOOR (0.3).

Symmetry operators come from midas_stress; nothing is hand-listed here.

Implemented Laue families: cubic (SG 195–230) and hexagonal (168–194). Anything else raises rather than silently falling back to cubic.

Far-field (Grains.csv)

from midas_plotting import ff, read_grains

g = read_grains("Grains.csv")
print(len(g), g.space_group)        # symmetry is read from the file's header

ff.summary(g)                        # one-page overview
ff.grain_map(g, color="ipf")         # IPF-coloured grain centres
ff.ipf_legend(g.space_group)         # the colour key
ff.pole_figure(g, hkl=(1, 1, 1))
ff.strain_map(g, kind="vonmises")
midas-plot Grains.csv --kind summary -o overview.png
midas-plot Grains.csv --kind pole --hkl 1,1,1
midas-plot Grains.csv --kind strain --strain-kind hydrostatic

FF output is a grain list, not a voxel grid, so these are scatter and distribution plots. They are namespaced under ff rather than exported flat because both modalities have a grain_map and they mean different things: maps.grain_map labels a near-field voxel grid, ff.grain_map scatters far-field grain centres.

Things the module will not let you get wrong:

  • Symmetry comes from the file. Grains.csv states its space group in the preamble; the plots use it. Defaulting to cubic would colour a hexagonal sample with the wrong IPF triangle and produce a plausible, wrong figure.
  • Columns are read by name. Grains.csv has 47 columns and midas-fit-grain 0.5.6 shipped a cyclic rotation of three of them; a positional reader inherits that silently.
  • Euler angles are cross-checked against O11..O33. They describe the same orientation, so disagreement means the row is being sliced wrong — you get a warning instead of a wrong colour.
  • Strain is already microstrain. The eFab/eKen columns are not dimensionless; they are not rescaled.

Two caveats the plots cannot fix: FF grain positions are good to ~100 µm (not the six decimals the file prints), and GrainRadius is only correct with midas-process-grains >= 0.6.1.

Laue (solutions.txt, spots.txt)

from midas_plotting import laue, read_solutions, read_spots

sol = read_solutions("solutions.txt")     # one row per orientation PER FRAME
print(sol.summary())                      # ... 4,746 distinct orientations ...
sol = sol.gate(11)                        # the measured null for THAT scan

c = laue.cluster(sol, 1.0, space_group=194)
print(c)          # <GrainClusters 631 grains at 1.0deg (of 636 clusters,
                  #  5 spanning >half the map), n_eff 309.5>

reps = c.representatives(sol.orient_mat)  # one orientation per grain
laue.tilt_histogram(reps)                 # against the random reference
laue.texture_strength(reps)               # (peak, chance, peak/chance)
laue.summary(sol)
midas-plot solutions.txt --kind tilt --gate 11 --sg 194
midas-plot validated.npz --kind summary --sg 194 --tol 1.0

Laue output is neither a voxel grid nor a grain list: it is one row per orientation per frame, so a crystal seen at twenty positions appears twenty times. Nothing is a grain until it has been clustered, and every grain count here carries the tolerance that produced it.

Four things the module will not let you get wrong:

  • Half of a random population lies more than 60° from any fixed direction. That is solid angle, not texture. tilt_histogram draws random_tilt_fractions() beside the data by default, because "70% of grains lie near the surface plane" reads as a strong texture and is very nearly random — and 30% there is a depletion.
  • A raw pole density is not comparable between datasets. A small grain population peaks higher by chance alone, and its chance level rises to match. texture_strength returns the ratio to its own measured null, which is what makes 85 grains and 631 grains commensurable.
  • An orientation present at every raster position is not a grain. The beam moves a micron or two between frames. cluster flags anything spanning more than half the map; on one dataset a single such object held 59% of all measurements and dragged the effective sample size from 29 to 2.5. The Kish effective n sits next to every grain count for the same reason.
  • orientationRowNr is column 34 and misOrientationPostRefinement is 33. Reading 33 for 34 does not raise — it returns a near-zero float for every row, so distinct-orientation counts collapse to single digits and the scan looks like it found one crystal. Columns are read by name.

Geometry is explicit, never assumed: SURFACE_NORMAL_34IDE and the COS45 stage correction are module constants with 34-ID-E defaults, and every function takes normal=. The out-of-plane stage axis sits at 45°, so quoting its raw extent as a map size understates it by 1.41× — a 200 × 100 µm map reads as 200 × 71.

The acceptance gate has no default. It is the largest number of reflections a randomly oriented crystal achieves on those frames, it is a property of the scan, and midas-plot says so when you omit --gate rather than picking one.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

midas_plotting-0.3.1.tar.gz (49.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

midas_plotting-0.3.1-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file midas_plotting-0.3.1.tar.gz.

File metadata

  • Download URL: midas_plotting-0.3.1.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for midas_plotting-0.3.1.tar.gz
Algorithm Hash digest
SHA256 1cbb46038e54c8e2bed58eed2e8cb9660c3276576e6e57a9f05862b6aac01a10
MD5 21f5b75fb49c48d79121b0f01bd3b189
BLAKE2b-256 a0266a634c73bea24a3d22038a01a46f0a9e060a7f48d280c46831191d8b20b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for midas_plotting-0.3.1.tar.gz:

Publisher: python-packages.yml on marinerhemant/MIDAS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file midas_plotting-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: midas_plotting-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 43.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for midas_plotting-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 570fe78124430a63e64d4375a0cbf9c90d968030616c017c09b56a0b2232adb0
MD5 fa308dda1b15617ea566237af70e3998
BLAKE2b-256 0d7f18d3c4011749eee1e151f42594e0a43c70387bfc2e76269e8c87d8eb706c

See more details on using hashes here.

Provenance

The following attestation bundles were made for midas_plotting-0.3.1-py3-none-any.whl:

Publisher: python-packages.yml on marinerhemant/MIDAS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.2

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page