Skip to content

Error with calling Cosmic-conn from py script on Gemini GMOS 2D spec #12

@Karuntg

Description

@Karuntg

Hi Chengyuan
I tried Cosmic-conn from within a script based on the example you had given. I am running this on the same Gemini GMOS 2D spec, as in my earlier issue.I have copied the code below for ref. The script reads and loads the data now, but the error I get is:

[W NNPACK.cpp:51] Could not initialize NNPACK! Reason: Unsupported hardware.

I don't have GPU on this machine, but think Cosmic-conn automatically reverts to the slower CPU version?

pls let me know
thx
karun

Here is my simple script:

script to run cosmic-conn on command line

import numpy as np
from astropy import *
import astropy.io.fits as pyfits
from astropy.stats import sigma_clipped_stats

read in the transf 2d spec

datadir = '/copiapo1/karun/Cosmic_COnn/cr_tst/'
fits = 'tgsqgsS20221115S0065.fits'
sci = 2 # extension number of science

read data into array

fits_path = datadir+fits
data = pyfits.getdata(fits_path,ext=sci)
head = pyfits.getheader(fits_path, ext=sci)

shap = data.shape
print(shap)
rows,cols = shap[0],shap[1]
print('Size of 2D spec: ',rows,cols)

from cosmic_conn import init_model

initialize a Cosmic-CoNN model

cr_model = init_model("ground_imaging")

the model outputs a CR probability map in np.float32

data = data.astype(np.float32)
cr_prob = cr_model.detect_cr(data)

convert the probability map to a boolean mask with a 0.5 threshold

cr_mask = cr_prob > 0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions