简体   繁体   English

Google Colab 上的 Running.EXE 或 Perl 文件

[英]Running .EXE or Perl file on Google Colab

I want to process a set of HDR files with an Executable (eg, falsecolor2.exe) file on google colab.我想在 google colab 上处理一组带有可执行文件(例如 falsecolor2.exe)的 HDR 文件。

The source file is here: https://github.com/mostaphaRoudsari/honeybee/blob/master/resources/falsecolor2.exe?raw=true sample HDR files: http://www.anyhere.com/gward/hdrenc/pages/originals.html源文件在这里: https://github.com/mostaphaRoudsari/honeybee/blob/master/resources/falsecolor2.exe?raw=true示例 HDR 文件: http://www.anyhere.com/gward/hdrenc/page /originals.html

The executable takes an HDR file with some arguments and generates a new HDR file.可执行文件获取一个带有一些 arguments 的 HDR 文件并生成一个新的 HDR 文件。 On my local machine and drive, the following code works OK:在我的本地机器和驱动器上,以下代码可以正常工作:

import os
os.system(r'D:\falsecolor2.exe -i D:\test.hdr -s 250.0 -n 10 -mask 0.1 -l lux -m 179 -lp EN -z > D:\test@fc.hdr')

I am not sure how to create a similar process in colab;我不确定如何在 colab 中创建类似的流程; after mounting the gdrive, the following code generates a 0 byte not-working HDR in my gdrive and returns error code 32256.安装 gdrive 后,以下代码在我的 gdrive 中生成一个 0 字节不工作的 HDR,并返回错误代码 32256。

import os
os.system('/content/drive/My\ Drive/falsecolor2.exe -i /content/drive/My\ Drive/MOSELEY\ IMAGES/test.hdr -s 250.0 -n 10 -mask 0.1 -l lux -m 179 -lp EN -z > /content/drive/My\ Drive/test@fc.hdr')

I read some threads on shell and linux executables but could not replicate any of them successfully.我在 shell 和 linux 可执行文件上阅读了一些线程,但无法成功复制其中任何一个。

You can install Radiance in Google Colab like this:您可以像这样在 Google Colab 中安装 Radiance:

# Download the Linux compiled version of radiance from Github (e.g. 5.3, latest official release at the moment):
!wget -O radiance.zip https://github.com/LBNL-ETA/Radiance/releases/download/012cb178/Radiance_012cb178_Linux.zip

# Unzip it
!unzip radiance.zip

# Extract the tar.gz to /usr/local/radiance
!tar -xvf radiance-5.3.012cb17835-Linux.tar.gz --strip-components=1 -C /

# Add /usr/local/radiance/bin to the PATH environment variable
path = %env PATH
%env PATH=/usr/local/radiance/bin:$path

# Set the RAYPATH environment variable to /usr/local/radiance/lib
%env RAYPATH=/usr/local/radiance/lib

I ran !lsb_release -a to find out the Linux distribution in Google Colab and it said that it was Ubuntu 18.04.我运行!lsb_release -a以找出 Google Colab 中的 Linux 分布,它说它是 Ubuntu 18.04。 Unfortunately, Radiance does not seem to be available for that version, but only for 16.04.不幸的是,Radiance 似乎不适用于该版本,而仅适用于 16.04。 That is why getting it from Github seems to be the next simplest solution.这就是为什么从 Github 获取它似乎是下一个最简单的解决方案。 See radiance in Ubuntu Packages :请参阅Ubuntu 封装中的辐射

Exact hits准确命中

Package radiance Package 光辉

  • xenial (16.04LTS) (graphics): Lighting Simulation and Rendering System [universe] 4R1+20120125-1.1: amd64 arm64 armhf i386 powerpc ppc64el s390x xenial (16.04LTS) (graphics): Lighting Simulation and Rendering System [universe] 4R1+20120125-1.1: amd64 arm64 armhf i386 powerpc ppc64el s390x

Then I tried to run your falsecolor command using one of the sample images you linked and found that the -lp and -z options are not available:然后我尝试使用您链接的示例图像之一运行您的falsecolor命令,发现-lp-z选项不可用:

# Get a sample HDR file
!wget -O input.hdr http://www.anyhere.com/gward/hdrenc/pages/img/Apartment_float_o15C.hdr

# Try original command
!falsecolor -i input.hdr -s 250.0 -n 10 -mask 0.1 -l lux -m 179 -lp EN -z > output.hdr

# Output:
# bad option "-lp"

# Remove option -lp
!falsecolor -i input.hdr -s 250.0 -n 10 -mask 0.1 -l lux -m 179 -z > output.hdr

# Output:
# bad option "-z"

If you remove those options the command runs successfully:如果删除这些选项,命令将成功运行:

# Remove option -z
!falsecolor -i input.hdr -s 250.0 -n 10 -mask 0.1 -l lux -m 179 > output.hdr

# List output file
!ls -lh output.hdr

# Output:
# -rw-r--r-- 1 root root 4.8M Mar 31 02:57 output.hdr

See a demo in this colab .这个 colab中查看演示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM