From 18252ab7d144a4b973df308ef7c5ac75094be1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20G=C3=B3is?= <89877277+flpgs@users.noreply.github.com> Date: Thu, 23 Dec 2021 22:45:57 -0300 Subject: [PATCH 1/2] Changes in Head (#1) --- FITS-images.ipynb | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/FITS-images.ipynb b/FITS-images.ipynb index ccbcc5d..d169ffb 100644 --- a/FITS-images.ipynb +++ b/FITS-images.ipynb @@ -4,23 +4,26 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Viewing and manipulating FITS images\n", + "# Visualização e manipulação de imagens FITS\n", "\n", - "## Authors\n", + "## Autores\n", "Lia Corrales, Kris Stern, Stephanie T. Douglas, Kelle Cruz\n", "\n", - "## Learning Goals\n", - "* Open FITS files and load image data\n", - "2. Make a 2D histogram with image data\n", - "3. Stack several images into a single image\n", - "4. Write image data to a FITS file\n", + "## Tradução\n", + "Filipe Góis\n", "\n", - "## Keywords\n", - "FITS, file input/output, image manipulation, numpy, matplotlib, histogram, colorbar\n", + "## Objetivos\n", + "* Abrir arquivos FITS e carregar dados da imagem\n", + "2. Fazer um histograma 2D com dados da imagem\n", + "3. Juntar várias imagens em uma única imagem\n", + "4. Escreve dados da imagem em um arquivo FITS\n", "\n", - "## Summary\n", + "## Palavras-chave\n", + "FITS, entrada/saída de arquivo, manipulação de imagem, numpy, matplotlib, histograma, barra de cor\n", "\n", - "This tutorial demonstrates the use of `astropy.utils.data` to download a data file, then uses `astropy.io.fits` to open the file, and lastly uses `matplotlib` to view the image with different color scales and stretches and to make histograms. In this tutorial we've also included a demonstration of simple image stacking." + "## Resumo\n", + "\n", + "Este tutorial mostra o uso do astropy.utils.data para baixar um arquivo de dados, então usa astropy.io.fits para abrir o arquivo, e, por fim, usa matplotlib para vizualizar a imagem com diferentes escalas de cores, stretches e para fazer histogramas. Neste tutorial, incluímos, também, uma demonstração de uma junção simples de imagens" ] }, { @@ -42,7 +45,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Download the example FITS files for this tutorial." + "Baixe os arquivos FITS para este tutorial" ] }, { @@ -59,14 +62,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Opening FITS files and loading the image data" + "## Abrindo arquivos FITS e carregando os dados da imagem" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Let's open the FITS file to find out what it contains." + "Abramos o arquivo FITS para descobrir o que ele contém." ] }, { @@ -83,7 +86,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Generally, the image information is located in the PRIMARY block. The blocks are numbered and can be accessed by indexing hdu_list." + "Geralmente, a informação da imagem está localizada no bloco PRIMARY. Os blocos são numerado e podem ser acessados indexando hud_list." ] }, { From f74d33817a65d2cbd897cdb1c662c066feab2799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20G=C3=B3is?= <89877277+flpgs@users.noreply.github.com> Date: Fri, 7 Jan 2022 21:07:39 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Tradu=C3=A7=C3=A3o=20do=20arquivo=20para=20?= =?UTF-8?q?o=20portugu=C3=AAs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FITS-images.ipynb | 73 ++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/FITS-images.ipynb b/FITS-images.ipynb index d169ffb..a485e6e 100644 --- a/FITS-images.ipynb +++ b/FITS-images.ipynb @@ -26,6 +26,13 @@ "Este tutorial mostra o uso do astropy.utils.data para baixar um arquivo de dados, então usa astropy.io.fits para abrir o arquivo, e, por fim, usa matplotlib para vizualizar a imagem com diferentes escalas de cores, stretches e para fazer histogramas. Neste tutorial, incluímos, também, uma demonstração de uma junção simples de imagens" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Geralmente, a informação da imagem está localizada no bloco PRIMARY. Os blocos são numerado e podem ser acessados indexando hud_list." + ] + }, { "cell_type": "code", "execution_count": null, @@ -82,13 +89,6 @@ "hdu_list.info()" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Geralmente, a informação da imagem está localizada no bloco PRIMARY. Os blocos são numerado e podem ser acessados indexando hud_list." - ] - }, { "cell_type": "code", "execution_count": null, @@ -102,7 +102,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Our data is now stored as a 2D numpy array. But how do we know the dimensions of the image? We can look at the `shape` of the array." + "Agora, nosso dado está armazenado em um *array* Numpy bidimensional. Mas como sabemos as dimensões da imagem? Podemos analisar o `shape` do *array*." ] }, { @@ -119,7 +119,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Great! At this point, we can close the FITS file because we've stored everything we wanted to a variable." + "Ótimo! A esta altura, podemos fechar o arquivo FITS, porque já armazenamos tudo que queríamos para uma variável." ] }, { @@ -135,14 +135,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### SHORTCUT" + "### ATALHO" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "If you don't need to examine the FITS header, you can call `fits.getdata` to bypass the previous steps." + "Se você não precisa examinar o cabeçalho do arquivo FITS, você pode chamar a função `fits.getdata` para pular os passos anteriores." ] }, { @@ -160,7 +160,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Viewing the image data and getting basic statistics" + "## Vendo o dado da imagem e obtendo estatísticas básicas" ] }, { @@ -172,7 +172,7 @@ "plt.imshow(image_data, cmap='gray')\n", "plt.colorbar()\n", "\n", - "# To see more color maps\n", + "# Para ver mais mapas de cores\n", "# http://wiki.scipy.org/Cookbook/Matplotlib/Show_colormaps" ] }, @@ -180,7 +180,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's get some basic statistics about our image:" + "Obtenhamos algumas estatísticas básicas de nossa imagem:" ] }, { @@ -199,21 +199,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Plotting a histogram" + "### Plotando um histograma" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "To make a histogram with `matplotlib.pyplot.hist()`, we'll need to cast the data from a 2D array to something one dimensional." + "Para fazer um histograma com `matplotlib.pyplot.hist()`, precisamos transferir o dado de um *array* bidimensional para algo unidimensional." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "In this case, let's use the `ndarray.flatten()` to return a 1D numpy array." + "Neste caso, usemos a função `ndarray.flatten()` para transformar um *array* Numpy unidimensional. " ] }, { @@ -238,14 +238,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Displaying the image with a logarithmic scale" + "### Mostando a imagem em escala logarítmica" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "What if we want to use a logarithmic color scale? To do so, we'll need to load the `LogNorm` object from `matplotlib`." + "E se quisermos usar uma escala logarítmica de cores? Para fazer isso, precisamos carregar o objeto `LogNorm` da biblioteca `matplotlib`." ] }, { @@ -265,6 +265,7 @@ "source": [ "plt.imshow(image_data, cmap='gray', norm=LogNorm())\n", "\n", + "# Escolhi as marcas de escala baseado no histograma acima\n", "# I chose the tick marks based on the histogram above\n", "cbar = plt.colorbar(ticks=[5.e3,1.e4,2.e4])\n", "cbar.ax.set_yticklabels(['5,000','10,000','20,000'])" @@ -274,21 +275,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Basic image math: image stacking" + "## Matemática Básica com a imagem: junção de imagens" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "You can also perform math with the image data like any other numpy array. In this particular example, we'll stack several images of M13 taken with a ~10'' telescope." + "Você também pode fazer cálculos com o dado da imagem com qualquer outro *array* Numpy. Neste exemplo em particular, juntaremos várias imagens de M13 tiradas com um telescópio de ~10\"." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Let's start by opening a series of FITS files and store the data in a list, which we've named `image_concat`." + "Comecemos abrindo uma série de aruivo FITS e armazenando o dado em uma lista, a qual chamamos de `image_concat`." ] }, { @@ -308,7 +309,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we'll stack the images by summing the concatenated list." + "Agora, juntaremos as imagens chamando a lista concatenada." ] }, { @@ -317,13 +318,13 @@ "metadata": {}, "outputs": [], "source": [ - "# The long way\n", + "# O caminho mais longo\n", "final_image = np.zeros(shape=image_concat[0].shape)\n", "\n", "for image in image_concat:\n", " final_image += image\n", "\n", - "# The short way\n", + "# O caminho mais curto\n", "# final_image = np.sum(image_concat, axis=0)" ] }, @@ -331,7 +332,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We're going to show the image, but need to decide on the best stretch. To do so let's plot a histogram of the data." + "Vamos mostrar a imagem, mas precisamos decidir qual o melhor trecho. Para isso, plotemos um histograma do dado. " ] }, { @@ -347,7 +348,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We'll use the keywords `vmin` and `vmax` to set limits on the color scaling for `imshow`." + "Usaremos as palavras-chave `vmin` and `vmax` para limitar a escala de cores para `imshow`." ] }, { @@ -364,21 +365,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Writing image data to a FITS file" + "## Escrevendo o dado da imagem em um arquivo FITS" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "We can do this with the `writeto()` method." + "Podemos fazer isso com o método `writeto()`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Warning: you'll receive an error if the file you are trying to write already exists. That's why we've set `overwrite=True`." + "**AVISO:** você receberá uma mensagem de erro se o arquivo que você está tentando escrever já existe. Por isso, colocamos `overwrite=True`." ] }, { @@ -397,14 +398,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Exercises" + "## Exercícios" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Determine the mean, median, and standard deviation of a part of the stacked M13 image where there is *not* light from M13. Use those statistics with a sum over the part of the image that includes M13 to estimate the total light in this image from M13." + "Determine a média, mediana e o desvio-padrão da parte da imagem juntada de M13 onde *não* há luz de M13. Use estas estatísticas com uma soma sobre a parte da imagem que inclui M13 para estimar a luz total nesta imagem de M13. " ] }, { @@ -418,8 +419,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Show the image of the Horsehead Nebula, but in units of *surface brightness* (magnitudes per square arcsecond).\n", - "(Hint: the *physical* size of the image is 15x15 arcminutes.)" + "Mostre a image da Nebulosa Cabeça de Cavalo, mas em unidade de *brilho superficial* (magnitudes por segundo de arco ao quadrado). \n", + "(Dica: o tamanho *físico* da imagem é 15x15 minutos de arco.)" ] }, { @@ -433,8 +434,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now write out the image you just created, preserving the header the original image had, but add a keyword 'UNITS' with the value 'mag per sq arcsec'.\n", - "(Hint: it may be helpful to read the [astropy.io.fits](http://docs.astropy.org/en/stable/io/fits/index.html) documentation if you're not sure how to include both the header and the data.)" + "Agora, salve a imagem que você acabou de criar, preservando o cabeçalho da imagem original, mas adicione a chave 'UNITS' com o valor 'mag per sq arcsec'. \n", + "(Dica: leia a documentação de [astropy.io.fits](http://docs.astropy.org/en/stable/io/fits/index.html) se você não sabe como incluir o cabeçalho e o dado.)" ] }, {