Adding an interface to use DustPy with MCFOST#47
Conversation
Added the documentation for the DustPy_integration package
There was a problem hiding this comment.
Code Review
This pull request introduces a new DustPy_integration module to pymcfost, enabling the conversion of DustPy simulation results into MCFOST-compatible FITS density files across various settling models (no settling, parametric, Dubrulle, and Fromang). Feedback highlights several critical issues, including an invalid module import extension in __init__.py, hardcoded loop ranges that ignore function arguments, and an undefined variable in a plotting function. Additionally, improvements were suggested for dynamic subplot handling and the correction of multiple typos in function names and documentation.
| from .fitsigma import * | ||
| from .chi2_functions import * | ||
| from .BO_fitting import * | ||
| from .DustPy_integration.py import * |
There was a problem hiding this comment.
|
|
||
| Z_cscl[r_cell]=( Hp_array[r_cell] * 7) / number_of_vertical_cells #Defines the size of one vertical cell by deviding 7 times the local pressure scale height by the number of cells (Why 7 times? To match MCFOST) | ||
|
|
||
| for Z_cell in range (1,71): |
There was a problem hiding this comment.
The loop range is hardcoded to 71 (70 iterations), but the function accepts number_of_vertical_cells as an argument and uses it to initialize the arrays. If number_of_vertical_cells is not 70, this will cause an IndexError (if smaller) or fail to populate the entire grid (if larger). This hardcoded value appears in multiple places throughout the file (lines 283, 384, 398, 491, 505, 595, 615, 625) and should be updated to use the argument.
| for Z_cell in range (1,71): | |
| for Z_cell in range(1, number_of_vertical_cells + 1): |
|
|
||
| plt.figure(figsize=(80,80)) | ||
| for i in range (0,len(DustPy_file[0,:])): | ||
| plt.subplot(10,10,i+1) |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
added a missing ')'
Changes in this pull request:
DustPy is a dust evolution code, that calculates amongst other things the density of dust grain along the radial direction. Because these simulations are highly configurable, it is interesting to see the changes this produces in artificial images like the ones MCFOST can create.
As such, this python package acts as an interface between the two codes to convert DustPy data files into 2D (r and Z direction) density files MCFOST can read via it's -density_file option.
It leaves the choice of vertical extension of the radial density profile to the user, following the 4 prescriptions MCFOST uses: no settling, parametric settling, Dubrulle settling, or Fromang settling.
It also provides a tool to control that MCFOST reads correctly its density file.
The init file has been updated to include this new package
The documentation has been updated to explain how to use this new package