Group Abstract Group Abstract

Message Boards Message Boards

0
|
220 Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:

Import[] is changing the context and with it fails to import the file I want

Posted 20 days ago

I have this small notebook snippet. This one was working about a year ago.

In[4]:= (* Set HistoryLength *)
$HistoryLength = 1;
(* Set working directory *)
SetDirectory["/Volumes/Data/Projects/SpeckleSH/Data"];
Directory[]

Out[6]= "/Volumes/Data/Projects/SpeckleSH/Data"

(* Read fits files. Scientific contains 999 pictures, \
waveform contains 2000 pictures *)
fps = Import["/Volumes/Data/Projects/SpeckleSH/Data/q880_0284.fits", 
   "RawData"];
fps[[1, 1]]

In[1]:= Directory[]

Out[1]= "/Volumes/Home/janos"

In[1]:= fps // Length

Out[1]= 0

So, Import[] is changing the directory specified by SetDirectory back to the user home directory, and cannot find the file, although it is specified with a full path. What is wrong here? Thanks ahead, János

POSTED BY: Janos Lobb
3 Replies
Posted 20 days ago

Well, I am on a MacBook Air M1 and when I ran that small notebook I was on 10.15.1. I upgraded yesterday to 10.15.6 and following that to Tahoe 26.1. Mathematica version is "Wolfram 14.3.0.11930707".

In the meantime I decided not to use Import because I had similar experiences 11 years ago working with .fits files. I will just use OpenRead and BinaryRead to read from the fits file the header and data. The fits file itself contain astronomical data between 1000 and 3000, 256x256 grayscale images 16 bits. Nothing especially extra . But thanks for looking into this Import, although now looks like it became not so Import-ant for me. Best, János

POSTED BY: Janos Lobb
Posted 20 days ago

I cannot reproduce. Based on what you're showing, I assume there was something about the data that caused the kernel to crash. You don't show any output for fps[[1,1]], and that would be consistent with the kernel crashing and therefore not evaluating fps[[1,1]], If you then evaluated the expressions following that, the output you showed would also be consistent with a crash, e.g. Directory[] pointing to your home directory. So I would check your data. It might be too large or malformed somehow.

Just in case that's not the explanation, you might want to provide your Mathematica version and your operating system to better help debug.

POSTED BY: Eric Rimbey
Posted 20 days ago

Hi Eric, Sorry my previous reply went to myself. The other problem is that Import is crashing silently, as if nothing happened. It would be nice to minimum get a Message into the FrontEnd that the kernel departed to the "forever hunting grounds" ;-) A red sidebar and a direct error reporting into the notebook would be even nicer. There are speckle imaging repositories in the Internet. If someone whose job is maintaining Import could ask for some sample speckle stacks in fits file format and play with it so that way future generations of Mathematica users would not run Into this strongly bearded bug of Import. Thanks ahead, János P.S. I cannot send mine because I am not the owner of it.

POSTED BY: Janos Lobb
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard