{'fraction_non_alphanumeric': 0.02936839518309167, 'fraction_numerical': 0.015360039321700663, 'mean_word_length': 5.055803571428571, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
NMAGIC made-to-measure particle models of galaxies

The parallel code NMAGIC is an implementation of a particle-based method to create made-to-measure models in agreement with observations of galaxies. It works by slowly correcting the particle weights of an evolving N-body system, until a satisfactory compromise is achieved between the goodness of the fit to a given set of observational data, and some degree of smoothness (regularization) of the underlying particle model. We briefly describe the method together with a new regularization scheme in phase-space, which improves recovering the correct orbit structure in the models. We also mention some practical applications showing the power of the technique in investigating the dynamics of galaxies.


Introduction
In the last decades, an increasing amount of high quality photometric and kinematic data for galaxies have become available. The dynamical state of the observed galaxy, however, cannot be directly inferred from observations, due to projection effects, and modelling is essential to learn about the distribution of stellar orbits and the total (i.e. due to luminous and dark matter) gravitational potential in the observed galaxy. Therefore, several methods to model the observational data and create "made-to-measure" models have been devised.
Another technique which is widely used is the Schwarzschild orbit superposition method (Schwarzschild 1979(Schwarzschild , 1993: a large library of orbits is computed in a fixed potential, and then the weights of individual orbits are adjusted until the model matches the photometry and kinematics of the target galaxy (Richstone & Tremaine 1985;Cappellari et al. 2002;Gebhardt et al. 2003;Valluri et al. 2004;Thomas et al. 2005; van den Bosch & de Zeeuw 2010). Syer & Tremaine (1996) proposed an alternative, particle-based method. A modified version suitable for modelling observational data with errors was designed by de Lorenzi et al. (2007) and implemented in the parallel code NMAGIC. More recent implementations of this method can be found in Dehnen (2009) and Long & Mao (2010). The basic idea is to evolve a system of particles while slowly correcting the 2 Morganti & Gerhard individual weights of particles until the N-body system reproduces the observational data. The method is very powerful, since no orbit library needs to be computed or stored, no symmetry restrictions need to be imposed, and the potential can be evolved self-consistently from the particles. Moreover, the algorithm properly accounts for observational errors, and a great variety of observational data can be used simultaneously in the weight adaptation, including photometry, long-slit spectroscopic data, integral field absorption-line kinematics, and PNe velocities. So far, the particle made-to-measure method has been used to investigate the dynamics of the Milky Way's bulge and disk (Bissantz et al. 2004), and the dark matter fraction and orbital structure in the outer halos of elliptical galaxies (de Lorenzi et al. 2008(de Lorenzi et al. , 2009Das et al. 2011).

Made-to-measure particle models of observational data
An N-body system of particles is trained to reproduce the observables of a target galaxy by maximizing the merit function with respect to the particle weights w i (see e.g. Syer & Tremaine 1996;de Lorenzi et al. 2007). Such maximization strikes a compromise between the goodness of the fit (χ 2 ) in terms of deviations between target and particle model observables, and a pseudo- which serves the purpose of regularization. Since typically the number of particles is much higher than the number of noisy and sparse constraints on the particle model, the problem is intrinsically ill-conditioned, and some regularization is necessary. This is achieved by pushing particle weights towards a smooth distribution of predetermined priorsŵ i . The maximization of equation (1) translates to a prescription for adapting the weights of the particles while they are evolved in the gravitational potential, which can be either fixed and known a priori, or time-varying and self-consistently computed.

Regularizing particle models
Traditionally, priors are set toŵ i = w 0 = 1/N (the "flat" priors in Bayesian statistics), and are kept constant during the modelling. Likewise, the individual weights of the initial particle model are usually set to 1/N. However, as discussed in Morganti & Gerhard (2012), smoothing the weights globally towards a set of preassigned, constant priors makes it difficult to construct made-tomeasure galaxy models with both smooth and anisotropic DFs unless the initial particle model is already close to the target galaxy, i.e. the dynamics of the galaxy is already known. In this paper, we described and implemented in NMAGIC a new regularization method based on moving (i.e. not constant) priors which follow the smooth phase-space structures traced by the weight distribution, as the latter evolves to match the observational data. The computation of such new individual priors is particularly easy when the integrals of motion are known, or at least one can compute approximately conserved quantities from the particle orbits. In Morganti & Gerhard (2012) we consider spherical and axisymmetric cases, and show that the procedure facilitates recovering both a smoother and more accurate DF without erasing global phase-space gradients.

Convergence to a theoretically unique solution
It is a natural question whether the made-to-measure modelling technique can recover the target properties from observations independently of the initial particle model. As we show in Morganti & Gerhard (2012), if a unique inversion of data to recover the underlying target DF exists (Dejonghe & Merritt 1992), then it can actually be found via NMAGIC modelling. In Fig. 1 the quality to which the orbital anisotropy of the target galaxy can be recovered in such a case for different initial particle models can be appreciated. Figure 1. Recovery of the anisotropy parameter of a spherical target galaxy (full black line) from idealized line-of-sight velocity data. Radius is normalized by the model's half-light radius R e . The black lines, nearly on top of each other, show the final NMAGIC models obtained with our new regularization scheme using different initial particle models (corresponding grey lines). By contrast, lack or poor quality of data introduce degeneracies in the dynamical modelling results; see Morganti & Gerhard (2012) for a quantitative analysis.

Modelling the halos of elliptical galaxies
The outer halos of elliptical galaxies are particularly interesting because they are dark matter-dominated, and because the orbital structure of stars there more strongly preserves the imprint of formation mechanisms, due to longer dynamical time scales.
Dynamical models of these galaxies were constructed with NMAGIC, fitting a wide variety of photometric and kinematic data in a sequence of gravitational potentials for the dark matter halos. When modelling the intermediate luminosity ellipticals NGC 4697 andNGC 3379, de Lorenzi et al. (2008, 2009) found that a variety of potentials are consistent with the data, showing that the well-known mass-anisotropy degeneracy (Binney & Mamon 1982) remains substantial when the velocity dispersion strongly decreases with radius, even with data out to more than 5R e . By contrast, the mass distribution in luminous ellipticals with extended flat dispersion profiles is wellconstrained (Das et al. 2011).

Conclusions
The parallel code NMAGIC is a powerful tool to build made-to-measure galaxy models, which reproduce a wide variety of observational data. NMAGIC works by adapting the weights of an N-body particle system until the target observables are well matched, subject to additional regularization constraints.
We have briefly described a new, improved regularization scheme in phase-space, and shown how well the intrinsic properties of the target galaxy can be recovered independently of initial conditions, and how NMAGIC models can help us in learning about the orbital structure and gravitational potentials in galaxies.