-
Notifications
You must be signed in to change notification settings - Fork 1
A3d/ref tuts #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
A3d/ref tuts #7
Conversation
| @@ -0,0 +1,286 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tutorial for cubing should go on the 2-science-data/ dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps there should be two (or more) tutorials: one for basic stuff (explaining how to read a datacube, what are wavelength, intensity, and variance, how to make simple plots...), and another one on creating a cube from a set of RSS, which may contain advanced stuff such as registration or ADR.
In any case, why do we use a standard star instead of a galaxy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PabloCorcho noted.
@paranoya is there a fits file in the repository data that contains a galaxy?
PabloCorcho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot Miguel!!
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "datacube_shape = (std_star_rss[0].wavelength.size, 40, 60)\n", | ||
| "ref_position = (std_star_rss[0].wavelength[0], np.mean(std_star_rss[0].info['fib_ra']), np.mean(std_star_rss[0].info['fib_dec'])) # (deg, deg)\n", | ||
| "spatial_pixel_size = 1.0 << u.arcsec\n", | ||
| "spectral_pixel_size = std_star_rss[0].wavelength[1] - std_star_rss[0].wavelength[0] # (angstrom)\n", | ||
| "\n", | ||
| "print(f\"Creating a WCS with\\n position: {ref_position}\\n Spatial pixel size: {spatial_pixel_size}\\n Spectral pixel size: {spectral_pixel_size}\")\n", | ||
| "\n", | ||
| "wcs = build_wcs(datacube_shape=datacube_shape,\n", | ||
| " reference_position=ref_position,\n", | ||
| " spatial_pix_size=spatial_pixel_size,\n", | ||
| " spectra_pix_size=spectral_pixel_size,\n", | ||
| " )" | ||
| ] | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated cell?
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "#### `rss_intensity`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth explaining the meaning of this variable
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "\n", | ||
| "pos_com = find_centroid_in_dc(cube, centroider='com', com_power=1.)\n", | ||
| "pos_com_3 = find_centroid_in_dc(cube, centroider='com', com_power=3.)\n", | ||
| "pos_gauss = find_centroid_in_dc(cube, centroider='gauss')" | ||
| ] | ||
| }, | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a new section where the use of this method is explained?
| "source": [ | ||
| "interpolator = CubeInterpolator(rss_set=std_star_rss)\n", | ||
| "cube = interpolator.build_cube()\n", | ||
| "white_image = np.nanmean(cube.intensity, axis=0)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since cubes have a method cube.get_white_image it might be worth using that here instead
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "print(f\"Center of mass of the data cube: \\n\\n {cube.get_centre_of_mass()}\")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I would explain that the com is per wavelength unit
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "With `science_fibres` we can find the indexes of the fibres with non-bad pixels:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Science fibres are those that target the object of interest, sky fibres are the ones located in sky blanks to estimate the contribution of the sky emission. In the case of KOALA, there's no default sky fibres.
| "Now we select the wavelenght range. **Make sure to use astropy quantities and not simple float values.** \n", | ||
| "\n", | ||
| "In this case we will use the same elements of the RSS wavelengh data to define the range." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "rss_sample.get_integrated_fibres(wavelength_range=[6000,7000])" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You say the user has to make sure of using quantities, but then you pass a list of ints (which also works because we do not enforce the use of units here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this file and let the user create it on the fly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the output be .gitignore'd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this use for testing?
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "RSS metada is stored as a `DataContainerHistory` object" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link to the relevant tutorial?
Refactored tutorials made to follow refactored pykoala commits from Dec 2024 to April 2025. This MR includes preliminary version of cubing tutorial